/
python-os-testr.spec
180 lines (145 loc) · 4.33 KB
/
python-os-testr.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
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
%global pypi_name os-testr
%if 0%{?fedora}
%global with_python3 1
%endif
Name: python-%{pypi_name}
Version: 0.8.0
Release: 1%{?dist}
Summary: A testr wrapper to provide functionality for OpenStack projects
License: ASL 2.0
URL: http://git.openstack.org/cgit/openstack/%{pypi_name}
Source0: http://tarballs.openstack.org/os-testr/os-testr-%{upstream_version}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: python-pbr
BuildRequires: python-setuptools
Requires: python-pbr
Requires: python-babel
Requires: python-testrepository
Requires: python-subunit
Requires: python-testtools
Requires: python-setuptools
Provides: python2-os-testr
%description
ostestr is a testr wrapper that uses subunit-trace for output and builds
some helpful extra functionality around testr.
%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary: A testr wrapper to provide functionality for OpenStack projects
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-pbr
BuildRequires: python3-setuptools
Requires: python3-pbr
Requires: python3-babel
Requires: python3-testrepository
Requires: python3-subunit
Requires: python3-testtools
Requires: python3-setuptools
%description -n python3-%{pypi_name}
ostestr is a testr wrapper that uses subunit-trace for output and builds
some helpful extra functionality around testr.
%endif
%package doc
Summary: Documentation for ostestr module
BuildRequires: python-sphinx
BuildRequires: python-oslo-sphinx
%description doc
Documentation for ostestr module
%if 0%{?with_python3}
%package -n python3-%{pypi_name}-doc
Summary: Documentation for ostestr module
BuildRequires: python3-sphinx
BuildRequires: python3-oslo-sphinx
%description -n python3-%{pypi_name}-doc
Documentation for ostestr module
%endif
%prep
%setup -qc -n %{pypi_name}-%{upstream_version}
mv %{pypi_name}-%{upstream_version} python2
pushd python2
# Let RPM handle the dependencies
rm -f test-requirements.txt requirements.txt
cp -p LICENSE ChangeLog CONTRIBUTING.rst PKG-INFO README.rst ../
popd
%if 0%{?with_python3}
cp -a python2 python3
find python3 -name '*.py' | xargs sed -i 's|^#!/usr/bin/env python2|#!%{__python3}|'
%endif
find python2 -name '*.py' | xargs sed -i 's|^#!/usr/bin/env python2|#!%{__python2}|'
%build
pushd python2
%{__python2} setup.py build
popd
%if 0%{?with_python3}
pushd python3
%{__python3} setup.py build
popd
%endif
%install
pushd python2
%{__python2} setup.py install --skip-build --root=$RPM_BUILD_ROOT
for file in $RPM_BUILD_ROOT%{python2_sitelib}/os_testr/{subunit_trace,ostestr,subunit2html}.py; do
chmod a+x $file
done
export PYTHONPATH="$( pwd ):$PYTHONPATH"
pushd doc
sphinx-build -b html -d build/doctrees source build/html
# Fix hidden-file-or-dir warnings
rm -fr build/html/.buildinfo
# Fix this rpmlint warning
sed -i "s|\r||g" build/html/_static/jquery.js
popd
popd
%if 0%{?with_python3}
pushd python3
%{__python3} setup.py install --skip-build --root=$RPM_BUILD_ROOT
for file in $RPM_BUILD_ROOT%{python3_sitelib}/os_testr/{subunit_trace,ostestr,subunit2html}.py;do
chmod a+x $file
done
export PYTHONPATH="$( pwd ):$PYTHONPATH"
pushd doc
sphinx-build-3 -b html -d build/doctrees source build/html
# Fix hidden-file-or-dir warnings
rm -fr build/html/.buildinfo
# Fix this rpmlint warning
sed -i "s|\r||g" build/html/_static/jquery.js
popd
popd
%endif
%files
%doc README.rst
%license LICENSE
%if ! 0%{?with_python3}
%{_bindir}/generate-subunit
%{_bindir}/ostestr
%{_bindir}/subunit-trace
%{_bindir}/subunit2html
%endif
%{python2_sitelib}/os_testr
%{python2_sitelib}/os_testr-*.egg-info
%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.rst
%license LICENSE
%{_bindir}/generate-subunit
%{_bindir}/ostestr
%{_bindir}/subunit-trace
%{_bindir}/subunit2html
%{python3_sitelib}/os_testr
%{python3_sitelib}/os_testr-*.egg-info
%endif
%files doc
%license LICENSE
%doc python2/doc/build/html
%if 0%{?with_python3}
%files -n python3-%{pypi_name}-doc
%license LICENSE
%doc python3/doc/build/html
%endif
%changelog
* Thu Sep 29 2016 Chandan Kumar <chkumar@redhat.com> 0.8.0-1
- Update to 0.8.0
* Sun Sep 11 2016 Haikel Guemar <hguemar@fedoraproject.org> 0.7.0-1
- Update to 0.7.0