]>
Commit | Line | Data |
---|---|---|
f320d32d ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_with tests # do not perform "make test" | |
4 | %bcond_without python3 # CPython 3.x module | |
5 | ||
6 | %define module pip | |
7 | Summary: A tool for installing and managing Python packages | |
8 | Name: python-%{module} | |
9 | Version: 1.3.1 | |
1f61faa8 | 10 | Release: 2 |
f320d32d ER |
11 | License: MIT |
12 | Group: Development/Libraries | |
13 | URL: http://www.pip-installer.org | |
14 | Source0: http://pypi.python.org/packages/source/p/pip/%{module}-%{version}.tar.gz | |
15 | # Source0-md5: cbb27a191cebc58997c4da8513863153 | |
16 | # Sent to dstufft (upstream) | |
17 | Patch0: 0001-fix-for-http-bugs.python.org-issue17980-in-code-back.patch | |
18 | BuildRequires: python-devel | |
57b31609 | 19 | BuildRequires: python-modules |
f320d32d | 20 | BuildRequires: python-setuptools |
57b31609 | 21 | BuildRequires: rpm-pythonprov |
f320d32d ER |
22 | %if %{with python3} |
23 | BuildRequires: python3-devel | |
57b31609 | 24 | BuildRequires: python3-modules |
f320d32d ER |
25 | BuildRequires: python3-setuptools |
26 | %endif | |
27 | Requires: python-setuptools | |
28 | BuildArch: noarch | |
29 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
30 | ||
31 | %description | |
32 | Pip is a replacement for easy_install. It uses mostly the same | |
33 | techniques for finding packages, so packages that were made | |
34 | easy_installable should be pip-installable as well. | |
35 | ||
36 | %package -n python3-pip | |
37 | Summary: A tool for installing and managing Python3 packages | |
38 | Group: Development/Libraries | |
39 | Requires: python3-setuptools | |
40 | ||
41 | %description -n python3-pip | |
42 | Pip is a replacement for easy_install. It uses mostly the same | |
43 | techniques for finding packages, so packages that were made | |
44 | easy_installable should be pip-installable as well. | |
45 | ||
46 | %prep | |
47 | %setup -q -n %{module}-%{version} | |
48 | %patch0 -p1 | |
49 | ||
50 | %{__sed} -i '1d' pip/__init__.py | |
51 | ||
52 | %if %{with python3} | |
53 | set -- * | |
54 | install -d py3 | |
55 | cp -a "$@" py3 | |
56 | %endif | |
57 | ||
58 | %build | |
59 | %{__python} setup.py build | |
60 | ||
61 | %if %{with python3} | |
62 | cd py3 | |
63 | %{__python3} setup.py build | |
64 | %endif | |
65 | ||
66 | %install | |
67 | rm -rf $RPM_BUILD_ROOT | |
68 | ||
69 | %if %{with python3} | |
70 | cd py3 | |
71 | %{__python3} setup.py install \ | |
72 | --optimize=2 \ | |
73 | --skip-build \ | |
74 | --root $RPM_BUILD_ROOT | |
75 | ||
76 | # Change the name of the python3 pip executable in order to not conflict with | |
77 | # the python2 executable | |
78 | mv $RPM_BUILD_ROOT%{_bindir}/pip $RPM_BUILD_ROOT%{__python}3-pip | |
79 | ||
80 | # after changing the pip-python binary name, make a symlink to the old name, | |
81 | # that will be removed in a later version | |
82 | # https://bugzilla.redhat.com/show_bug.cgi?id=855495 | |
83 | ln -s python3-pip $RPM_BUILD_ROOT%{_bindir}/pip-python3 | |
84 | ||
85 | # The install process creates both pip and pip-<python_abiversion> that seem to | |
86 | # be the same. Remove the extra script | |
87 | %{__rm} $RPM_BUILD_ROOT%{_bindir}/pip-3* | |
88 | cd - | |
89 | %endif | |
90 | ||
91 | %{__python} setup.py install \ | |
92 | --optimize=2 \ | |
93 | --skip-build \ | |
94 | --root $RPM_BUILD_ROOT | |
95 | ||
96 | %py_postclean | |
97 | ||
98 | # The install process creates both pip and pip-<python_abiversion> that seem to | |
99 | # be the same. Since removing pip-* also clobbers pip-python3, just remove pip-2* | |
100 | %{__rm} $RPM_BUILD_ROOT%{_bindir}/pip-2* | |
101 | ||
102 | # The pip executable no longer needs to be renamed to avoid conflict with perl-pip | |
103 | # https://bugzilla.redhat.com/show_bug.cgi?id=958377 | |
104 | # However, we'll keep a python-pip alias for now | |
105 | ln -s pip $RPM_BUILD_ROOT%{__python}-pip | |
106 | ||
107 | # after changing the pip-python binary name, make a symlink to the old name, | |
108 | # that will be removed in a later version | |
109 | # https://bugzilla.redhat.com/show_bug.cgi?id=855495 | |
110 | ln -s pip $RPM_BUILD_ROOT%{_bindir}/pip-python | |
111 | ||
112 | %clean | |
113 | rm -rf $RPM_BUILD_ROOT | |
114 | ||
115 | %files | |
116 | %defattr(644,root,root,755) | |
117 | %doc docs/* | |
118 | %attr(755,root,root) %{_bindir}/pip | |
119 | %attr(755,root,root) %{_bindir}/pip-python | |
120 | %attr(755,root,root) %{_bindir}/python-pip | |
121 | %{py_sitescriptdir}/pip-%{version}-py*.egg-info | |
122 | %{py_sitescriptdir}/pip | |
123 | ||
124 | %if %{with python3} | |
125 | %files -n python3-pip | |
126 | %defattr(644,root,root,755) | |
127 | %doc docs/* | |
128 | %attr(755,root,root) %{_bindir}/pip-python3 | |
129 | %attr(755,root,root) %{_bindir}/python3-pip | |
130 | %{py3_sitescriptdir}/pip | |
131 | %{py3_sitescriptdir}/pip-%{version}-py*.egg-info | |
132 | %endif |