]>
Commit | Line | Data |
---|---|---|
140ca651 ER |
1 | # |
2 | # Conditional build: | |
8de31e80 | 3 | %bcond_without doc # don't build doc |
140ca651 ER |
4 | %bcond_with tests # tests are failing currently |
5 | %bcond_without python2 # CPython 2.x module | |
6 | %bcond_with python3 # CPython 3.x module | |
7 | ||
8 | %define module pbr | |
9 | Summary: Python Build Reasonableness | |
10 | Name: python-%{module} | |
11 | Version: 0.10.0 | |
12 | Release: 1 | |
13 | License: Apache v2.0 | |
14 | Group: Libraries/Python | |
15 | Source0: http://pypi.python.org/packages/source/p/%{module}/%{module}-%{version}.tar.gz | |
16 | # Source0-md5: 9e02dbfb5e49210c381fd4eea00cf7b7 | |
17 | URL: http://pypi.python.org/pypi/pbr | |
18 | BuildRequires: rpmbuild(macros) >= 1.219 | |
19 | BuildRequires: rpm-pythonprov | |
8de31e80 ER |
20 | %if %{with doc} |
21 | BuildRequires: sphinx-pdg | |
22 | %endif | |
140ca651 ER |
23 | %if %{with python2} |
24 | # very new required, when also using tests | |
25 | BuildRequires: python-Sphinx >= 1.1.3 | |
26 | BuildRequires: python-d2to1 >= 0.2.10 | |
27 | BuildRequires: python-devel | |
28 | %endif | |
29 | %if %{with tests} | |
30 | BuildRequires: python-testscenarios | |
31 | BuildRequires: python-testtools | |
32 | # still not packaged yet: | |
33 | BuildRequires: python-coverage >= 3.6 | |
34 | BuildRequires: python-discover | |
35 | BuildRequires: python-flake8 | |
36 | BuildRequires: python-mock >= 1.0 | |
37 | BuildRequires: python-subunit | |
38 | BuildRequires: python-testrepository >= 0.0.18 | |
39 | BuildRequires: python-testresources | |
40 | %endif | |
41 | %if %{with python3} | |
42 | BuildRequires: python3-d2to1 | |
43 | BuildRequires: python3-devel | |
44 | %endif | |
45 | Requires: python-pip | |
46 | BuildArch: noarch | |
47 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
48 | ||
49 | %description | |
50 | PBR is a library that injects some useful and sensible default | |
51 | behaviors into your setuptools run. It started off life as the chunks | |
52 | of code that were copied between all of the OpenStack projects. Around | |
53 | the time that OpenStack hit 18 different projects each with at least 3 | |
54 | active branches, it seems like a good time to make that code into a | |
55 | proper re-usable library. | |
56 | ||
57 | %package -n python3-pbr | |
58 | Summary: Python Build Reasonableness | |
59 | Group: Libraries/Python | |
60 | ||
61 | %description -n python3-pbr | |
62 | Manage dynamic plugins for Python applications | |
63 | ||
64 | %prep | |
65 | %setup -q -n %{module}-%{version} | |
66 | ||
67 | # Remove the requirements file so that pbr hooks don't add it | |
68 | # to distutils requiers_dist config | |
69 | rm -rf {test-,}requirements.txt | |
70 | ||
71 | # Remove bundled egg-info | |
72 | rm -rf %{module}.egg-info | |
73 | ||
74 | %build | |
75 | %if %{with python2} | |
76 | %{__python} setup.py build --build-base build-2 %{?with_tests:test} | |
77 | %endif | |
78 | ||
79 | %if %{with python3} | |
80 | %{__python3} setup.py build --build-base build-3 %{?with_tests:test} | |
81 | %endif | |
82 | ||
83 | %if %{with test} | |
84 | %{__python} setup.py test | |
85 | %endif | |
86 | ||
87 | # generate html docs | |
88 | sphinx-build doc/source html | |
89 | # remove the sphinx-build leftovers | |
90 | rm -rf html/.{doctrees,buildinfo} | |
91 | ||
92 | %install | |
93 | rm -rf $RPM_BUILD_ROOT | |
94 | %if %{with python2} | |
95 | %{__python} setup.py \ | |
96 | build --build-base build-2 \ | |
97 | install --skip-build \ | |
98 | --optimize=2 \ | |
99 | --root=$RPM_BUILD_ROOT | |
100 | ||
101 | %py_postclean | |
102 | %endif | |
103 | ||
104 | %if %{with python3} | |
105 | %{__python3} setup.py \ | |
106 | build --build-base build-3 \ | |
107 | install --skip-build \ | |
108 | --optimize=2 \ | |
109 | --root=$RPM_BUILD_ROOT | |
110 | %endif | |
111 | ||
112 | %clean | |
113 | rm -rf $RPM_BUILD_ROOT | |
114 | ||
115 | %if %{with python2} | |
116 | %files | |
117 | %defattr(644,root,root,755) | |
118 | %doc html README.rst LICENSE | |
119 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
120 | %{py_sitescriptdir}/%{module} | |
121 | %endif | |
122 | ||
123 | %if %{with python3} | |
124 | %files -n python3-pbr | |
125 | %defattr(644,root,root,755) | |
126 | %doc html README.rst LICENSE | |
127 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
128 | %{py3_sitescriptdir}/%{module} | |
129 | %endif |