This repository was archived by the owner on Apr 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpython-setuptools-spec.patch
105 lines (94 loc) · 3.19 KB
/
python-setuptools-spec.patch
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
diff --git a/python-setuptools.spec b/python-setuptools.spec
index 221c55f..4c30551 100644
--- a/python-setuptools.spec
+++ b/python-setuptools.spec
@@ -1,14 +1,23 @@
%if 0%{?fedora}
%global with_python3 1
+%global build_wheel 1
%else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
%endif
%global srcname setuptools
+%if 0%{?build_wheel}
+%global python2_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
+%global python2_record %{python2_sitelib}/%{srcname}-%{version}.dist-info/RECORD
+%if 0%{?with_python3}
+%global python3_wheelname %python2_wheelname
+%global python3_record %{python3_sitelib}/%{srcname}-%{version}.dist-info/RECORD
+%endif
+%endif
Name: python-setuptools
Version: 2.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Easily build and distribute Python packages
Group: Applications/System
@@ -25,8 +34,16 @@ BuildArch: noarch
Requires: python-backports-ssl_match_hostname
BuildRequires: python-backports-ssl_match_hostname
BuildRequires: python2-devel
+%if 0%{?build_wheel}
+BuildRequires: python-pip
+BuildRequires: python-wheel
+%endif
%if 0%{?with_python3}
BuildRequires: python3-devel
+%if 0%{?build_wheel}
+BuildRequires: python3-pip
+BuildRequires: python3-wheel
+%endif
%endif # if with_python3
# For unittests
BuildRequires: subversion
@@ -92,12 +109,19 @@ for file in setuptools/command/easy_install.py ; do
done
%build
-
+%if 0%{?build_wheel}
+%{__python} setup.py bdist_wheel
+%else
CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build
+%endif
%if 0%{?with_python3}
pushd %{py3dir}
+%if 0%{?build_wheel}
+%{__python3} setup.py bdist_wheel
+%else
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
+%endif
popd
%endif # with_python3
@@ -110,9 +136,20 @@ rm -rf %{buildroot}
# Change to defaulting to python3 version in F22
%if 0%{?with_python3}
pushd %{py3dir}
+%if 0%{?build_wheel}
+pip3 install -I dist/%{python3_wheelname} --root %{buildroot} --strip-file-prefix %{buildroot}
+# TODO: we have to remove this by hand now, but it'd be nice if we wouldn't have to
+# (pip install wheel doesn't overwrite)
+rm %{buildroot}%{_bindir}/easy_install
+sed -i '/\/usr\/bin\/easy_install,/d' %{buildroot}%{python3_record}
+%else
%{__python3} setup.py install --skip-build --root %{buildroot}
+%endif
rm -rf %{buildroot}%{python3_sitelib}/setuptools/tests
+%if 0%{?build_wheel}
+sed -i '/^setuptools\/tests\//d' %{buildroot}%{python3_record}
+%endif
install -p -m 0644 %{SOURCE1} %{SOURCE2} %{py3dir}
find %{buildroot}%{python3_sitelib} -name '*.exe' | xargs rm -f
@@ -120,9 +155,16 @@ chmod +x %{buildroot}%{python3_sitelib}/setuptools/command/easy_install.py
popd
%endif # with_python3
+%if 0%{?build_wheel}
+pip2 install -I dist/%{python2_wheelname} --root %{buildroot} --strip-file-prefix %{buildroot}
+%else
%{__python} setup.py install --skip-build --root %{buildroot}
+%endif
rm -rf %{buildroot}%{python_sitelib}/setuptools/tests
+%if 0%{?build_wheel}
+sed -i '/^setuptools\/tests\//d' %{buildroot}%{python2_record}
+%endif
install -p -m 0644 %{SOURCE1} %{SOURCE2} .
find %{buildroot}%{python_sitelib} -name '*.exe' | xargs rm -f