source: spec/trunk/SPECS/python-setuptools.spec@ 1127

Last change on this file since 1127 was 1127, checked in by Silvan Scherrer, 8 years ago

spec: python-setuptools: Release version 34.4.1-1.

File size: 6.6 KB
Line 
1
2%global with_check 0
3%global build_wheel 0
4
5%global with_python3 0
6
7%global srcname setuptools
8%if 0%{?build_wheel}
9%global python2_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
10%global python2_record %{python2_sitelib}/%{srcname}-%{version}.dist-info/RECORD
11%if 0%{?with_python3}
12%global python3_wheelname %python2_wheelname
13%global python3_record %{python3_sitelib}/%{srcname}-%{version}.dist-info/RECORD
14%endif
15%endif
16
17Name: python-setuptools
18Version: 34.4.1
19Release: 1%{?dist}
20Summary: Easily build and distribute Python packages
21
22Group: Applications/System
23License: MIT
24URL: https://pypi.python.org/pypi/%{srcname}
25Vendor: bww bitwise works GmbH
26%scm_source github https://github.com/bitwiseworks/%{srcname}-os2 %{version}-os2
27
28
29BuildArch: noarch
30BuildRequires: python2-devel
31BuildRequires: python2-packaging
32BuildRequires: python2-appdirs
33%if 0%{?build_wheel}
34BuildRequires: python-pip
35BuildRequires: python-wheel
36%endif
37%if 0%{?with_check}
38BuildRequires: python2-pytest
39BuildRequires: python2-mock
40BuildRequires: python2-backports-unittest_mock
41%endif # with_check
42
43%if 0%{?with_python3}
44BuildRequires: python3-devel
45BuildRequires: python3-packaging
46BuildRequires: python3-appdirs
47%if 0%{?with_check}
48BuildRequires: python3-pytest
49BuildRequires: python3-mock
50%endif # with_check
51%if 0%{?build_wheel}
52BuildRequires: python3-pip
53BuildRequires: python3-wheel
54%endif # build_wheel
55%endif # with_python3
56
57# We're now back to setuptools as the package.
58# Keep the python-distribute name active for a few releases. Eventually we'll
59# want to get rid of the Provides and just keep the Obsoletes
60Provides: python-distribute = %{version}-%{release}
61Obsoletes: python-distribute < 0.6.36-2
62
63
64%description
65Setuptools is a collection of enhancements to the Python distutils that allow
66you to more easily build and distribute Python packages, especially ones that
67have dependencies on other packages.
68
69This package also contains the runtime components of setuptools, necessary to
70execute the software that requires pkg_resources.py.
71
72%package -n python2-setuptools
73Summary: Easily build and distribute Python packages
74%{?python_provide:%python_provide python2-setuptools}
75Requires: python2-packaging >= 16.8
76Requires: python2-six >= 1.6.0
77Requires: python2-appdirs >= 1.4.0
78%description -n python2-setuptools
79Setuptools is a collection of enhancements to the Python distutils that allow
80you to more easily build and distribute Python packages, especially ones that
81have dependencies on other packages.
82
83This package also contains the runtime components of setuptools, necessary to
84execute the software that requires pkg_resources.py.
85
86%if 0%{?with_python3}
87%package -n python3-setuptools
88Summary: Easily build and distribute Python 3 packages
89Requires: python3-packaging >= 16.8
90Requires: python3-six >= 1.6.0
91Requires: python3-appdirs >= 1.4.0
92Group: Applications/System
93%{?python_provide:%python_provide python3-setuptools}
94
95# Note: Do not need to Require python3-backports-ssl_match_hostname because it
96# has been present since python3-3.2. We do not ship python3-3.0 or
97# python3-3.1 anywhere
98
99%description -n python3-setuptools
100Setuptools is a collection of enhancements to the Python 3 distutils that allow
101you to more easily build and distribute Python 3 packages, especially ones that
102have dependencies on other packages.
103
104This package also contains the runtime components of setuptools, necessary to
105execute the software that requires pkg_resources.py.
106
107%endif # with_python3
108
109%prep
110%scm_setup
111python bootstrap.py
112
113# We can't remove .egg-info (but it doesn't matter, since it'll be rebuilt):
114# The problem is that to properly execute setuptools' setup.py,
115# it is needed for setuptools to be loaded as a Distribution
116# (with egg-info or .dist-info dir), it's not sufficient
117# to just have them on PYTHONPATH
118# Running "setup.py install" without having setuptools installed
119# as a distribution gives warnings such as
120# ... distutils/dist.py:267: UserWarning: Unknown distribution option: 'entry_points'
121# and doesn't create "easy_install" and .egg-info directory
122# Note: this is only a problem if bootstrapping wheel or building on RHEL,
123# otherwise setuptools are installed as dependency into buildroot
124
125# Strip shbang
126find setuptools -name \*.py | xargs sed -i -e '1 {/^#!\//d}'
127# Remove bundled exes
128rm -f setuptools/*.exe
129# These tests require internet connection
130rm setuptools/tests/test_integration.py
131
132
133%build
134%if 0%{?build_wheel}
135%py2_build_wheel
136%else
137%py2_build
138%endif
139
140%if 0%{?with_python3}
141%if 0%{?build_wheel}
142%py3_build_wheel
143%else
144%py3_build
145%endif
146%endif # with_python3
147
148%install
149# Must do the python3 install first because the scripts in /usr/bin are
150# overwritten with every setup.py install (and we want the python2 version
151# to be the default for now).
152%if 0%{?with_python3}
153%if 0%{?build_wheel}
154%py3_install_wheel %{python3_wheelname}
155
156# TODO: we have to remove this by hand now, but it'd be nice if we wouldn't have to
157# (pip install wheel doesn't overwrite)
158rm %{buildroot}%{_bindir}/easy_install
159
160sed -i '/\/usr\/bin\/easy_install,/d' %{buildroot}%{python3_record}
161%else
162%py3_install
163%endif
164
165rm -rf %{buildroot}%{python3_sitelib}/setuptools/tests
166%if 0%{?build_wheel}
167sed -i '/^setuptools\/tests\//d' %{buildroot}%{python3_record}
168%endif
169
170find %{buildroot}%{python3_sitelib} -name '*.exe' | xargs rm -f
171%endif # with_python3
172
173%if 0%{?build_wheel}
174%py2_install_wheel %{python2_wheelname}
175%else
176%py2_install
177%endif
178
179rm -rf %{buildroot}%{python2_sitelib}/setuptools/tests
180%if 0%{?build_wheel}
181sed -i '/^setuptools\/tests\//d' %{buildroot}%{python2_record}
182%endif
183
184find %{buildroot}%{python2_sitelib} -name '*.exe' | xargs rm -f
185
186# Don't ship these
187rm -r docs/Makefile
188rm -r docs/conf.py
189rm -r docs/_*
190
191%if 0%{?with_check}
192%check
193#LANG=en_US.utf8 PYTHONPATH=$(pwd) py.test
194
195%if 0%{?with_python3}
196LANG=en_US.utf8 PYTHONPATH=$(pwd) py.test-%{python3_version}
197%endif # with_python3
198%endif # with_check
199
200%files -n python2-setuptools
201%license LICENSE
202%doc docs/* CHANGES.rst README.rst
203%{python2_sitelib}/*
204%{_bindir}/easy_install
205%{_bindir}/easy_install-2.*
206
207%if 0%{?with_python3}
208%files -n python3-setuptools
209%license LICENSE CHANGES.rst README.rst
210%doc docs/*
211%{python3_sitelib}/easy_install.py
212%{python3_sitelib}/pkg_resources/
213%{python3_sitelib}/setuptools*/
214%{python3_sitelib}/__pycache__/*
215%{_bindir}/easy_install-3.*
216%endif # with_python3
217
218%changelog
219* Mon May 08 2017 Silvan Scherrer <silvan.scherrer@aroa.ch> 34.4.1-1
220- moved source to github
221- rebuilt with latest python macros
222
223* Mon Feb 27 2017 Silvan Scherrer <silvan.scherrer@aroa.ch> 34.2-0
224- first rpm version (internal version only)
Note: See TracBrowser for help on using the repository browser.