-
Notifications
You must be signed in to change notification settings - Fork 6
/
python-exampleclient.spec
183 lines (135 loc) · 4.75 KB
/
python-exampleclient.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
# Python3 support in OpenStack starts with version 3.5,
# which is only in Fedora 24+
%if 0%{?fedora} >= 24
%global with_python3 1
%endif
%global client python-exampleclient
%global sclient exampleclient
# If a executable is provided by the package uncomment following line
#%global executable example
Name: %{client}
Version: XXX
Release: XXX
Summary: OpenStack Example client
License: ASL 2.0
URL: http://launchpad.net/%{client}/
Source0: http://tarballs.openstack.org/%{client}/%{client}-master.tar.gz
BuildArch: noarch
%package -n python2-%{sclient}
Summary: OpenStack Example client
%{?python_provide:%python_provide python2-%{sclient}}
BuildRequires: python2-devel
BuildRequires: python-pbr
BuildRequires: python-setuptools
BuildRequires: git
# Test requirements should be added here as BuildRequires for tests in %check
Requires: python-oslo-config >= 2:3.4.0
%description -n python2-%{sclient}
OpenStack example client
%package -n python2-%{sclient}-tests
Summary: OpenStack example client tests
Requires: python2-%{sclient} = %{version}-%{release}
# Test requirements should be added here as Requires.
%description -n python2-%{sclient}-tests
OpenStack example client tests
This package contains the example client test files.
%package -n python-%{sclient}-doc
Summary: OpenStack example client documentation
BuildRequires: python-sphinx
BuildRequires: python-oslo-sphinx
%description -n python-%{sclient}-doc
OpenStack example client documentation
This package contains the documentation.
%if 0%{?with_python3}
%package -n python3-%{sclient}
Summary: OpenStack Example client
%{?python_provide:%python_provide python3-%{sclient}}
BuildRequires: python3-devel
BuildRequires: python3-pbr
BuildRequires: python3-setuptools
BuildRequires: git
# Test requirements should be added here as BuildRequires if adding tests in %check
Requires: python3-oslo-config >= 2:3.4.0
%description -n python3-%{sclient}
OpenStack example client
%package -n python3-%{sclient}-tests
Summary: OpenStack example client tests
Requires: python3-%{sclient} = %{version}-%{release}
# Test requirements should be added here as Requires.
%description -n python3-%{sclient}-tests
OpenStack example client tests
This package contains the example client test files.
%endif # with_python3
%description
OpenStack example library.
%prep
%autosetup -n %{client}-%{upstream_version} -S git
# Let's handle dependencies ourseleves
rm -f *requirements.txt
%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif
# generate html docs
%{__python2} setup.py build_sphinx
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
# If the client has man page uncomment following line
# %{__python2} setup.py build_sphinx --builder man
%install
%if 0%{?with_python3}
# If an executable is provided by the package uncomment following lines
#mv %{buildroot}%{_bindir}/%{executable} %{buildroot}%{_bindir}/%{executable}-%{python3_version}
#ln -s ./%{executable}-%{python3_version} %{buildroot}%{_bindir}/%{executable}-3
%py3_install
# If an executable is provided by the package uncomment following lines
#mv %{buildroot}%{_bindir}/%{executable} %{buildroot}%{_bindir}/%{executable}-%{python2_version}
#ln -s %{_bindir}/%{executable}-%{python2_version} %{buildroot}%{_bindir}/%{executable}-2
#ln -s %{_bindir}/%{executable}-2 %{buildroot}%{_bindir}/%{executable}
%endif
%py2_install
# If the client has man page uncomment following line
# install -p -D -m 644 man/%{executable}.1 %{buildroot}%{_mandir}/man1/%{executable}.1
%check
%if 0%{?with_python3}
%{__python3} setup.py test
rm -rf .testrepository
%endif
%{__python2} setup.py test
%files -n python2-%{sclient}
%license LICENSE
%{python2_sitelib}/%{sclient}
%{python2_sitelib}/*.egg-info
%exclude %{python2_sitelib}/%{sclient}/tests
# If the client has man page uncomment
#%{_mandir}/man1/%{executable}.1
# If an executable is provided by the package uncomment following lines
#%{_bindir}/%{executable}
#%{_bindir}/%{executable}-2
#%{_bindir}/%{executable}-%{python2_version}
#%endif
%files -n python2-%{sclient}-tests
%license LICENSE
%{python2_sitelib}/%{sclient}/tests
%files -n python-%{sclient}-doc
%license LICENSE
%doc html README.rst
%if 0%{?with_python3}
%files python3-%{sclient}
%license LICENSE
%{python3_sitelib}/%{sclient}
%{python3_sitelib}/*.egg-info
%exclude %{python3_sitelib}/%{sclient}/tests
# If the client has man page uncomment
#%{_mandir}/man1/%{executable}.1
# If an executable is provided by the package uncomment following lines
#%{_bindir}/%{executable}-3
#%{_bindir}/%{executable}-%{python3_version}
#%endif
%files -n python3-%{library}-tests
%license LICENSE
%{python3_sitelib}/%{sclient}/tests
%endif # with_python3
%changelog