diff --git a/pip-allow-older-versions.patch b/pip-allow-older-versions.patch new file mode 100644 index 0000000..74fb01e --- /dev/null +++ b/pip-allow-older-versions.patch @@ -0,0 +1,27 @@ +--- /usr/bin/pip3 2019-11-12 17:37:34.793131862 +0100 ++++ pip3 2019-11-12 17:40:42.014107134 +0100 +@@ -2,7 +2,23 @@ + # -*- coding: utf-8 -*- + import re + import sys +-from pip._internal.cli.main import main ++ ++try: ++ from pip._internal.cli.main import main ++except ImportError: ++ try: ++ from pip._internal.main import main ++ except ImportError: ++ try: ++ # If the user has downgraded pip, the above import will fail. ++ # Let's try older methods of invoking it: ++ ++ # pip 19 uses this ++ from pip._internal import main ++ except ImportError: ++ # older pip versions use this ++ from pip import main ++ + if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/python-pip.spec b/python-pip.spec index 8787d0d..3d035b5 100644 --- a/python-pip.spec +++ b/python-pip.spec @@ -1,4 +1,3 @@ -%bcond_without python2 %global srcname pip %global python_wheelname %{srcname}-%{version}-py2.py3-none-any.whl %global python_wheeldir %{_datadir}/python-wheels @@ -7,7 +6,7 @@ pip is the package installer for Python. You can use pip to install packages fro %global bashcompdir %(b=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null); echo ${b:-%{_sysconfdir}/bash_completion.d}) Name: python-%{srcname} Version: 20.2.2 -Release: 1 +Release: 3 Summary: A tool for installing and managing Python packages License: MIT and Python and ASL 2.0 and BSD and ISC and LGPLv2 and MPLv2.0 and (ASL 2.0 or BSD) URL: http://www.pip-installer.org @@ -17,17 +16,10 @@ Patch1: allow-stripping-given-prefix-from-wheel-RECORD-files.patch Patch2: emit-a-warning-when-running-with-root-privileges.patch Patch3: remove-existing-dist-only-if-path-conflicts.patch Patch6000: dummy-certifi.patch +Source10: pip-allow-older-versions.patch %description %{_description} -%package -n python2-%{srcname} -Summary: %{summary} -BuildRequires: python2-devel python2-setuptools ca-certificates -Requires: python2-setuptools ca-certificates -BuildRequires: python2-pip python2-wheel -%{?python_provide:%python_provide python2-%{srcname}} -%description -n python2-%{srcname} %{_description} - %package -n python%{python3_pkgversion}-%{srcname} Summary: %{summary} BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion}-setuptools bash-completion ca-certificates @@ -49,7 +41,6 @@ A Python wheel of pip to use with venv %autosetup -n %{srcname}-%{version} -p1 %build -%py2_build %py3_build_wheel %install @@ -62,17 +53,6 @@ A Python wheel of pip to use with venv --find-links dist \ 'pip==%{version}' -rm %{buildroot}%{_bindir}/pip - -%{__python2} dist/%{python_wheelname}/pip install \ - --root %{buildroot} \ - --no-deps \ - --no-cache-dir \ - --no-index \ - --ignore-installed \ - --find-links dist \ - 'pip==%{version}' - %if %{with doc} pushd docs/build/man install -d %{buildroot}%{_mandir}/man1 @@ -86,9 +66,9 @@ popd %endif # before we ln -s anything, we apply Source10 patch to all pips: -#for PIP in %{buildroot}%{_bindir}/pip*; do -#% patch -p1 --no-backup-if-mismatch $PIP < %{SOURCE10} -#done +for PIP in %{buildroot}%{_bindir}/pip*; do + patch -p1 --no-backup-if-mismatch $PIP < %{SOURCE10} +done mkdir -p %{buildroot}%{bashcompdir} PYTHONPATH=%{buildroot}%{python3_sitelib} \ @@ -110,18 +90,11 @@ echo rpm > %{buildroot}%{python3_sitelib}/pip-20.2.2.dist-info/INSTALLER mkdir -p %{buildroot}%{python_wheeldir} install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} - -%files -n python2-%{srcname} -%license LICENSE.txt -%{_bindir}/pip -%{_bindir}/pip2 -%{_bindir}/pip%{python2_version} -%{python2_sitelib}/pip* -%dir %{bashcompdir} -%dir %(dirname %{bashcompdir}) + %files -n python%{python3_pkgversion}-%{srcname} %license LICENSE.txt +%{_bindir}/pip %{_bindir}/pip3 %{_bindir}/pip-3* %{_bindir}/pip%{python3_version} @@ -139,6 +112,15 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} %{python_wheeldir}/%{python_wheelname} %changelog +* Wed Nov 4 2020 wangjie -20.2.2-3 +- Type:NA +- ID:NA +- SUG:NA +- DESC:remove python2 + +* Tue Sep 1 2020 wenzhanli - 20.2.2-2 +- add pip-allow-older-versions.patch + * Tue Aug 25 2020 wenzhanli - 20.2.2-1 - update to 20.2.2 and add python2 require