Package init
This commit is contained in:
commit
daeabfff97
89
allow-stripping-given-prefix-from-wheel-RECORD-files.patch
Normal file
89
allow-stripping-given-prefix-from-wheel-RECORD-files.patch
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
diff -ru pip-18.0/src/pip/_internal/commands/install.py pip-18.0_patched/src/pip/_internal/commands/install.py
|
||||||
|
--- pip-18.0/src/pip/_internal/commands/install.py 2018-07-20 06:10:48.000000000 +0200
|
||||||
|
+++ pip-18.0_patched/src/pip/_internal/commands/install.py 2018-07-23 16:49:39.085357813 +0200
|
||||||
|
@@ -110,6 +110,14 @@
|
||||||
|
default=None,
|
||||||
|
help="Installation prefix where lib, bin and other top-level "
|
||||||
|
"folders are placed")
|
||||||
|
+ cmd_opts.add_option(
|
||||||
|
+ '--strip-file-prefix',
|
||||||
|
+ dest='strip_file_prefix',
|
||||||
|
+ metavar='prefix',
|
||||||
|
+ default=None,
|
||||||
|
+ help="Strip given prefix from script paths in wheel RECORD."
|
||||||
|
+ )
|
||||||
|
+
|
||||||
|
|
||||||
|
cmd_opts.add_option(cmdoptions.build_dir())
|
||||||
|
|
||||||
|
@@ -345,6 +353,7 @@
|
||||||
|
pycompile=options.compile,
|
||||||
|
warn_script_location=warn_script_location,
|
||||||
|
use_user_site=options.use_user_site,
|
||||||
|
+ strip_file_prefix=options.strip_file_prefix,
|
||||||
|
)
|
||||||
|
|
||||||
|
lib_locations = get_lib_location_guesses(
|
||||||
|
diff -ru pip-18.0/src/pip/_internal/req/req_install.py pip-18.0_patched/src/pip/_internal/req/req_install.py
|
||||||
|
--- pip-18.0/src/pip/_internal/req/req_install.py 2018-07-22 07:14:20.000000000 +0200
|
||||||
|
+++ pip-18.0_patched/src/pip/_internal/req/req_install.py 2018-07-23 16:51:51.115943214 +0200
|
||||||
|
@@ -514,7 +514,7 @@
|
||||||
|
|
||||||
|
def move_wheel_files(self, wheeldir, root=None, home=None, prefix=None,
|
||||||
|
warn_script_location=True, use_user_site=False,
|
||||||
|
- pycompile=True):
|
||||||
|
+ pycompile=True, strip_file_prefix=None):
|
||||||
|
move_wheel_files(
|
||||||
|
self.name, self.req, wheeldir,
|
||||||
|
user=use_user_site,
|
||||||
|
@@ -524,6 +524,7 @@
|
||||||
|
pycompile=pycompile,
|
||||||
|
isolated=self.isolated,
|
||||||
|
warn_script_location=warn_script_location,
|
||||||
|
+ strip_file_prefix=strip_file_prefix,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Things valid for sdists
|
||||||
|
@@ -924,7 +925,7 @@
|
||||||
|
|
||||||
|
def install(self, install_options, global_options=None, root=None,
|
||||||
|
home=None, prefix=None, warn_script_location=True,
|
||||||
|
- use_user_site=False, pycompile=True):
|
||||||
|
+ use_user_site=False, pycompile=True, strip_file_prefix=None):
|
||||||
|
global_options = global_options if global_options is not None else []
|
||||||
|
if self.editable:
|
||||||
|
self.install_editable(
|
||||||
|
@@ -939,6 +940,7 @@
|
||||||
|
self.source_dir, root=root, prefix=prefix, home=home,
|
||||||
|
warn_script_location=warn_script_location,
|
||||||
|
use_user_site=use_user_site, pycompile=pycompile,
|
||||||
|
+ strip_file_prefix=strip_file_prefix,
|
||||||
|
)
|
||||||
|
self.install_succeeded = True
|
||||||
|
return
|
||||||
|
diff -ru pip-18.0/src/pip/_internal/wheel.py pip-18.0_patched/src/pip/_internal/wheel.py
|
||||||
|
--- pip-18.0/src/pip/_internal/wheel.py 2018-07-17 10:26:00.000000000 +0200
|
||||||
|
+++ pip-18.0_patched/src/pip/_internal/wheel.py 2018-07-23 16:52:57.749238655 +0200
|
||||||
|
@@ -206,7 +206,7 @@
|
||||||
|
|
||||||
|
def move_wheel_files(name, req, wheeldir, user=False, home=None, root=None,
|
||||||
|
pycompile=True, scheme=None, isolated=False, prefix=None,
|
||||||
|
- warn_script_location=True):
|
||||||
|
+ warn_script_location=True, strip_file_prefix=None):
|
||||||
|
"""Install a wheel"""
|
||||||
|
|
||||||
|
if not scheme:
|
||||||
|
@@ -507,7 +507,12 @@
|
||||||
|
writer.writerow(row)
|
||||||
|
for f in generated:
|
||||||
|
digest, length = rehash(f)
|
||||||
|
- writer.writerow((normpath(f, lib_dir), digest, length))
|
||||||
|
+ final_path = normpath(f, lib_dir)
|
||||||
|
+ if strip_file_prefix and final_path.startswith(strip_file_prefix):
|
||||||
|
+ final_path = os.path.join(os.sep,
|
||||||
|
+ os.path.relpath(final_path, strip_file_prefix))
|
||||||
|
+ writer.writerow((final_path, digest, length))
|
||||||
|
+
|
||||||
|
for f in installed:
|
||||||
|
writer.writerow((installed[f], '', ''))
|
||||||
|
shutil.move(temp_record, record)
|
||||||
15
dummy-certifi.patch
Normal file
15
dummy-certifi.patch
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
diff --git a/src/pip/_vendor/certifi/core.py b/src/pip/_vendor/certifi/core.py
|
||||||
|
index eab9d1d..30db215 100644
|
||||||
|
--- a/src/pip/_vendor/certifi/core.py
|
||||||
|
+++ b/src/pip/_vendor/certifi/core.py
|
||||||
|
@@ -19,9 +19,7 @@ class DeprecatedBundleWarning(DeprecationWarning):
|
||||||
|
|
||||||
|
|
||||||
|
def where():
|
||||||
|
- f = os.path.dirname(__file__)
|
||||||
|
-
|
||||||
|
- return os.path.join(f, 'cacert.pem')
|
||||||
|
+ return '/etc/pki/tls/certs/ca-bundle.crt'
|
||||||
|
|
||||||
|
|
||||||
|
def old_where():
|
||||||
31
emit-a-warning-when-running-with-root-privileges.patch
Normal file
31
emit-a-warning-when-running-with-root-privileges.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
diff -ru pip-18.0/src/pip/_internal/commands/install.py pip-18.0_patched/src/pip/_internal/commands/install.py
|
||||||
|
--- pip-18.0/src/pip/_internal/commands/install.py 2018-07-20 06:10:48.000000000 +0200
|
||||||
|
+++ pip-18.0_patched/src/pip/_internal/commands/install.py 2018-07-31 12:15:43.777317780 +0200
|
||||||
|
@@ -5,6 +5,8 @@
|
||||||
|
import operator
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
+import sys
|
||||||
|
+from os import path
|
||||||
|
from optparse import SUPPRESS_HELP
|
||||||
|
|
||||||
|
from pip._vendor import pkg_resources
|
||||||
|
@@ -205,6 +207,18 @@
|
||||||
|
def run(self, options, args):
|
||||||
|
cmdoptions.check_install_build_global(options)
|
||||||
|
|
||||||
|
+ def is_venv():
|
||||||
|
+ return hasattr(sys, 'real_prefix') or \
|
||||||
|
+ (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix)
|
||||||
|
+
|
||||||
|
+ # Check whether we have root privileges and aren't in venv/virtualenv
|
||||||
|
+ if os.getuid() == 0 and not is_venv():
|
||||||
|
+ logger.warning(
|
||||||
|
+ "WARNING: Running pip install with root privileges is "
|
||||||
|
+ "generally not a good idea. Try `%s install --user` instead."
|
||||||
|
+ % path.basename(sys.argv[0])
|
||||||
|
+ )
|
||||||
|
+
|
||||||
|
upgrade_strategy = "to-satisfy-only"
|
||||||
|
if options.upgrade:
|
||||||
|
upgrade_strategy = options.upgrade_strategy
|
||||||
BIN
pip-18.0.tar.gz
Normal file
BIN
pip-18.0.tar.gz
Normal file
Binary file not shown.
16
pip-allow-older-versions.patch
Normal file
16
pip-allow-older-versions.patch
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
--- /usr/bin/pip3 2018-03-29 15:22:13.000000000 +0200
|
||||||
|
+++ pip3 2018-05-04 11:49:08.098821010 +0200
|
||||||
|
@@ -4,7 +4,12 @@
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
-from pip._internal import main
|
||||||
|
+try:
|
||||||
|
+ from pip._internal import main
|
||||||
|
+except ImportError:
|
||||||
|
+ # user has most probably downgraded pip in their home
|
||||||
|
+ # so let them run it anyway until ~/.local/bin makes it in front of the PATH
|
||||||
|
+ from pip import main
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||||
162
python-pip.spec
Normal file
162
python-pip.spec
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
%bcond_without python2
|
||||||
|
%global srcname pip
|
||||||
|
%global python_wheelname %{srcname}-%{version}-py2.py3-none-any.whl
|
||||||
|
%global python_wheeldir %{_datadir}/python-wheels
|
||||||
|
%global _description \
|
||||||
|
pip is the package installer for Python. You can use pip to install packages from the Python Package Index and other indexes.
|
||||||
|
%global bashcompdir %(b=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null); echo ${b:-%{_sysconfdir}/bash_completion.d})
|
||||||
|
Name: python-%{srcname}
|
||||||
|
Version: 18.0
|
||||||
|
Release: 9
|
||||||
|
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
|
||||||
|
Source0: https://files.pythonhosted.org/packages/source/p/%{srcname}/%{srcname}-%{version}.tar.gz
|
||||||
|
BuildArch: noarch
|
||||||
|
Patch0: allow-stripping-given-prefix-from-wheel-RECORD-files.patch
|
||||||
|
Patch1: remove-existing-dist-only-if-path-conflicts.patch
|
||||||
|
Patch2: emit-a-warning-when-running-with-root-privileges.patch
|
||||||
|
Patch6000: dummy-certifi.patch
|
||||||
|
Source1: pip-allow-older-versions.patch
|
||||||
|
|
||||||
|
%description %{_description}
|
||||||
|
|
||||||
|
%if %{with python2}
|
||||||
|
%package -n python2-%{srcname}
|
||||||
|
Summary: %{summary}
|
||||||
|
BuildRequires: python2-devel python2-setuptools ca-certificates
|
||||||
|
Requires: python2-setuptools ca-certificates
|
||||||
|
BuildRequires: python2-pip python2-wheel
|
||||||
|
Provides: %{name}-wheel = %{version}-%{release}
|
||||||
|
Obsoletes: %{name}-wheel < %{version}-%{release}
|
||||||
|
%{?python_provide:%python_provide python2-%{srcname}}
|
||||||
|
%description -n python2-%{srcname} %{_description}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%package -n python%{python3_pkgversion}-%{srcname}
|
||||||
|
Summary: %{summary}
|
||||||
|
BuildRequires: python%{python3_pkgversion}-devel python%{python3_pkgversion}-setuptools bash-completion ca-certificates
|
||||||
|
Requires: python%{python3_pkgversion}-setuptools ca-certificates
|
||||||
|
BuildRequires: python%{python3_pkgversion}-pip python%{python3_pkgversion}-wheel
|
||||||
|
Provides: %{name}-wheel = %{version}-%{release}
|
||||||
|
Obsoletes: %{name}-wheel < %{version}-%{release}
|
||||||
|
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
|
||||||
|
%description -n python%{python3_pkgversion}-%{srcname} %{_description}
|
||||||
|
|
||||||
|
%package_help
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n %{srcname}-%{version} -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
%if %{with python2}
|
||||||
|
%py2_build
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%py3_build_wheel
|
||||||
|
|
||||||
|
%install
|
||||||
|
%py3_install_wheel %{python_wheelname}
|
||||||
|
rm %{buildroot}%{_bindir}/pip
|
||||||
|
%if %{with python2}
|
||||||
|
%py2_install_wheel %{python_wheelname}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
for PIP in %{buildroot}%{_bindir}/pip*; do
|
||||||
|
patch -p1 $PIP < %{SOURCE1}
|
||||||
|
done
|
||||||
|
|
||||||
|
mkdir -p %{buildroot}%{bashcompdir}
|
||||||
|
%if %{with python2}
|
||||||
|
PYTHONPATH=%{buildroot}%{python2_sitelib} \
|
||||||
|
%{buildroot}%{_bindir}/pip completion --bash \
|
||||||
|
> %{buildroot}%{bashcompdir}/pip
|
||||||
|
%endif
|
||||||
|
PYTHONPATH=%{buildroot}%{python3_sitelib} \
|
||||||
|
%{buildroot}%{_bindir}/pip3 completion --bash \
|
||||||
|
> %{buildroot}%{bashcompdir}/pip3
|
||||||
|
pips2=pip
|
||||||
|
pips3=pip3
|
||||||
|
for pip in %{buildroot}%{_bindir}/pip*; do
|
||||||
|
pip=$(basename $pip)
|
||||||
|
case $pip in
|
||||||
|
%if %{with python2}
|
||||||
|
pip2*)
|
||||||
|
pips2="$pips2 $pip"
|
||||||
|
ln -s pip %{buildroot}%{bashcompdir}/$pip
|
||||||
|
;;
|
||||||
|
%endif
|
||||||
|
pip3?*)
|
||||||
|
pips3="$pips3 $pip"
|
||||||
|
ln -s pip3 %{buildroot}%{bashcompdir}/$pip
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips3/" \
|
||||||
|
-e s/_pip_completion/_pip3_completion/ \
|
||||||
|
%{buildroot}%{bashcompdir}/pip3
|
||||||
|
|
||||||
|
%if %{with python2}
|
||||||
|
sed -i -e "s/^\\(complete.*\\) pip\$/\\1 $pips2/" \
|
||||||
|
%{buildroot}%{bashcompdir}/pip
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if %{with python2}
|
||||||
|
echo rpm > %{buildroot}%{python2_sitelib}/pip-%{version}.dist-info/INSTALLER
|
||||||
|
%endif
|
||||||
|
|
||||||
|
echo rpm > %{buildroot}%{python3_sitelib}/pip-%{version}.dist-info/INSTALLER
|
||||||
|
|
||||||
|
mkdir -p %{buildroot}%{python_wheeldir}
|
||||||
|
install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir}
|
||||||
|
|
||||||
|
%if %{with python2}
|
||||||
|
%files -n python2-%{srcname}
|
||||||
|
%license LICENSE.txt
|
||||||
|
%{_bindir}/pip
|
||||||
|
%{_bindir}/pip2
|
||||||
|
%{_bindir}/pip%{python2_version}
|
||||||
|
%{python2_sitelib}/pip*
|
||||||
|
%dir %{bashcompdir}
|
||||||
|
%{bashcompdir}/pip
|
||||||
|
%{bashcompdir}/pip2*
|
||||||
|
%dir %(dirname %{bashcompdir})
|
||||||
|
%dir %{python_wheeldir}/
|
||||||
|
%{python_wheeldir}/%{python_wheelname}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%files -n python%{python3_pkgversion}-%{srcname}
|
||||||
|
%license LICENSE.txt
|
||||||
|
%{_bindir}/pip3
|
||||||
|
%{_bindir}/pip%{python3_version}
|
||||||
|
%{python3_sitelib}/pip*
|
||||||
|
%dir %{bashcompdir}
|
||||||
|
%{bashcompdir}/pip3*
|
||||||
|
%dir %(dirname %{bashcompdir})
|
||||||
|
%dir %{python_wheeldir}/
|
||||||
|
%{python_wheeldir}/%{python_wheelname}
|
||||||
|
|
||||||
|
%files help
|
||||||
|
%doc README.rst
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Sun Sep 29 2019 yefei <yefei25@huawei.com> - 18.0-9
|
||||||
|
- Type:enhancement
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: Synchronize patches
|
||||||
|
|
||||||
|
* Sat Sep 28 2019 yefei <yefei25@huawei.com> - 18.0-8
|
||||||
|
- Type:enhancement
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: add bash completion and repair python2 interpreter path
|
||||||
|
|
||||||
|
* Wed Sep 25 2019 openEuler Buildteam <buildteam@openeuler.org> - 18.0-7
|
||||||
|
- Type:enhancement
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: Synchronize a patch
|
||||||
|
|
||||||
|
* Mon Sep 23 2019 openEuler Buildteam <buildteam@openeuler.org> - 18.0-6
|
||||||
|
- Package init
|
||||||
88
remove-existing-dist-only-if-path-conflicts.patch
Normal file
88
remove-existing-dist-only-if-path-conflicts.patch
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
commit b6d5da6796801862eb751a93d507c343af0604d6
|
||||||
|
Author: Victor Stinner <vstinner@redhat.com>
|
||||||
|
Date: Tue Sep 18 17:13:51 2018 +0200
|
||||||
|
|
||||||
|
Subject: Prevent removing of the system packages installed under /usr/lib
|
||||||
|
|
||||||
|
when pip install -U is executed.
|
||||||
|
|
||||||
|
Resolves: rhbz#1550368
|
||||||
|
|
||||||
|
Co-Authored-By: Michal Cyprian <m.cyprian@gmail.com>
|
||||||
|
|
||||||
|
diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py
|
||||||
|
index 8e91ecb..9beb100 100644
|
||||||
|
--- a/src/pip/_internal/req/req_install.py
|
||||||
|
+++ b/src/pip/_internal/req/req_install.py
|
||||||
|
@@ -36,7 +36,7 @@ from pip._internal.utils.hashes import Hashes
|
||||||
|
from pip._internal.utils.logging import indent_log
|
||||||
|
from pip._internal.utils.misc import (
|
||||||
|
_make_build_dir, ask_path_exists, backup_dir, call_subprocess,
|
||||||
|
- display_path, dist_in_site_packages, dist_in_usersite, ensure_dir,
|
||||||
|
+ display_path, dist_in_install_path, dist_in_site_packages, dist_in_usersite, ensure_dir,
|
||||||
|
get_installed_version, is_installable_dir, read_text_file, rmtree,
|
||||||
|
)
|
||||||
|
from pip._internal.utils.setuptools_build import SETUPTOOLS_SHIM
|
||||||
|
@@ -503,7 +503,7 @@ class InstallRequirement(object):
|
||||||
|
"lack sys.path precedence to %s in %s" %
|
||||||
|
(existing_dist.project_name, existing_dist.location)
|
||||||
|
)
|
||||||
|
- else:
|
||||||
|
+ elif dist_in_install_path(existing_dist):
|
||||||
|
self.conflicts_with = existing_dist
|
||||||
|
return True
|
||||||
|
|
||||||
|
diff --git a/src/pip/_internal/resolve.py b/src/pip/_internal/resolve.py
|
||||||
|
index 8480e48..b118098 100644
|
||||||
|
--- a/src/pip/_internal/resolve.py
|
||||||
|
+++ b/src/pip/_internal/resolve.py
|
||||||
|
@@ -20,7 +20,7 @@ from pip._internal.exceptions import (
|
||||||
|
)
|
||||||
|
from pip._internal.req.req_install import InstallRequirement
|
||||||
|
from pip._internal.utils.logging import indent_log
|
||||||
|
-from pip._internal.utils.misc import dist_in_usersite, ensure_dir
|
||||||
|
+from pip._internal.utils.misc import dist_in_install_path, dist_in_usersite, ensure_dir
|
||||||
|
from pip._internal.utils.packaging import check_dist_requires_python
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
@@ -123,7 +123,9 @@ class Resolver(object):
|
||||||
|
"""
|
||||||
|
# Don't uninstall the conflict if doing a user install and the
|
||||||
|
# conflict is not a user install.
|
||||||
|
- if not self.use_user_site or dist_in_usersite(req.satisfied_by):
|
||||||
|
+ if ((not self.use_user_site
|
||||||
|
+ or dist_in_usersite(req.satisfied_by))
|
||||||
|
+ and dist_in_install_path(req.satisfied_by)):
|
||||||
|
req.conflicts_with = req.satisfied_by
|
||||||
|
req.satisfied_by = None
|
||||||
|
|
||||||
|
diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py
|
||||||
|
index 3236af6..e60287b 100644
|
||||||
|
--- a/src/pip/_internal/utils/misc.py
|
||||||
|
+++ b/src/pip/_internal/utils/misc.py
|
||||||
|
@@ -32,7 +32,7 @@ from pip._internal.compat import (
|
||||||
|
from pip._internal.exceptions import CommandError, InstallationError
|
||||||
|
from pip._internal.locations import (
|
||||||
|
running_under_virtualenv, site_packages, user_site, virtualenv_no_global,
|
||||||
|
- write_delete_marker_file,
|
||||||
|
+ write_delete_marker_file, distutils_scheme,
|
||||||
|
)
|
||||||
|
|
||||||
|
if PY2:
|
||||||
|
@@ -324,6 +324,16 @@ def dist_in_site_packages(dist):
|
||||||
|
).startswith(normalize_path(site_packages))
|
||||||
|
|
||||||
|
|
||||||
|
+def dist_in_install_path(dist):
|
||||||
|
+ """
|
||||||
|
+ Return True if given Distribution is installed in
|
||||||
|
+ path matching distutils_scheme layout.
|
||||||
|
+ """
|
||||||
|
+ norm_path = normalize_path(dist_location(dist))
|
||||||
|
+ return norm_path.startswith(normalize_path(
|
||||||
|
+ distutils_scheme("")['purelib'].split('python')[0]))
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def dist_is_editable(dist):
|
||||||
|
"""Is distribution an editable install?"""
|
||||||
|
for path_item in sys.path:
|
||||||
Loading…
x
Reference in New Issue
Block a user