commit:     3d497622c6f95eb3e177d2134378a03ab517d1d1
Author:     Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Sat Nov 23 00:13:03 2019 +0000
Commit:     Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Sat Nov 23 00:21:52 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d497622

dev-python/pip-19.3.1-r1: Revbump, update install patch for --prefix

Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-2.3.79, Repoman-2.3.18
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>

 .../files/pip-19.3.1-disable-system-install.patch  |  17 +++
 dev-python/pip/pip-19.3.1-r1.ebuild                | 119 +++++++++++++++++++++
 2 files changed, 136 insertions(+)

diff --git a/dev-python/pip/files/pip-19.3.1-disable-system-install.patch 
b/dev-python/pip/files/pip-19.3.1-disable-system-install.patch
new file mode 100644
index 00000000000..70583957bd7
--- /dev/null
+++ b/dev-python/pip/files/pip-19.3.1-disable-system-install.patch
@@ -0,0 +1,17 @@
+install: Raise an error to avoid breaking python-exec
+
+Running pip without --target, --root, or --user will result in packages
+being installed systemwide. This has a tendency to break python-exec if
+setuptools gets installed or upgraded.
+
+--- pip-19.1/src/pip/_internal/commands/install.py
++++ pip-19.1/src/pip/_internal/commands/install.py
+@@ -246,6 +246,9 @@ class InstallCommand(RequirementCommand):
+         if options.upgrade:
+             upgrade_strategy = options.upgrade_strategy
+
++        if not any((options.use_user_site, options.target_dir, 
options.root_path, options.prefix_path)):
++            raise CommandError("(Gentoo) Please run pip with the --user 
option to avoid breaking python-exec")
++
+         if options.build_dir:
+             options.build_dir = os.path.abspath(options.build_dir)

diff --git a/dev-python/pip/pip-19.3.1-r1.ebuild 
b/dev-python/pip/pip-19.3.1-r1.ebuild
new file mode 100644
index 00000000000..e631044bd5a
--- /dev/null
+++ b/dev-python/pip/pip-19.3.1-r1.ebuild
@@ -0,0 +1,119 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy{,3} )
+PYTHON_REQ_USE="ssl(+),threads(+)"
+
+inherit bash-completion-r1 distutils-r1 multiprocessing
+
+SETUPTOOLS_PV="41.4.0"
+WHEEL_PV="0.33.6"
+
+DESCRIPTION="Installs python packages -- replacement for easy_install"
+HOMEPAGE="https://pip.pypa.io/ https://pypi.org/project/pip/ 
https://github.com/pypa/pip/";
+SRC_URI="
+       https://github.com/pypa/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
+       test? (
+               
https://files.pythonhosted.org/packages/py2.py3/s/setuptools/setuptools-${SETUPTOOLS_PV}-py2.py3-none-any.whl
+               
https://files.pythonhosted.org/packages/py2.py3/w/wheel/wheel-${WHEEL_PV}-py2.py3-none-any.whl
+       )
+"
+# PyPI archive does not have tests, so we need to download from GitHub.
+# setuptools & wheel .whl files are required for testing, exact version is not 
very important.
+
+LICENSE="MIT"
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+IUSE="test -vanilla"
+
+# disable-system-install patch breaks tests
+RESTRICT="!vanilla? ( test )"
+
+RDEPEND="
+       >=dev-python/setuptools-39.2.0[${PYTHON_USEDEP}]
+"
+DEPEND="
+       ${RDEPEND}
+       test? (
+               dev-python/freezegun[${PYTHON_USEDEP}]
+               dev-python/mock[${PYTHON_USEDEP}]
+               dev-python/pretend[${PYTHON_USEDEP}]
+               <dev-python/pytest-4[${PYTHON_USEDEP}]
+               dev-python/pytest-cov[${PYTHON_USEDEP}]
+               <dev-python/pytest-rerunfailures-7.0[${PYTHON_USEDEP}]
+               dev-python/pytest-timeout[${PYTHON_USEDEP}]
+               <dev-python/pytest-xdist-1.28.0[${PYTHON_USEDEP}]
+               dev-python/pyyaml[${PYTHON_USEDEP}]
+               dev-python/scripttest[${PYTHON_USEDEP}]
+               dev-python/wheel[${PYTHON_USEDEP}]
+       )
+"
+
+python_prepare_all() {
+       local PATCHES=(
+               "${FILESDIR}/${PN}-19.3-disable-version-check.patch"
+       )
+       if ! use vanilla; then
+               PATCHES+=( 
"${FILESDIR}/pip-19.3.1-disable-system-install.patch" )
+       fi
+       distutils-r1_python_prepare_all
+
+       if use test; then
+               mkdir tests/data/common_wheels/
+               cp 
"${DISTDIR}"/setuptools-${SETUPTOOLS_PV}-py2.py3-none-any.whl 
tests/data/common_wheels/ || die
+               cp "${DISTDIR}"/wheel-${WHEEL_PV}-py2.py3-none-any.whl 
tests/data/common_wheels/ || die
+       fi
+}
+
+python_test () {
+       # pip test suite likes to test installed version of pip, both the 
module and the executable.
+       # Here we install it into a temporary dir and add to PATHs in a 
subshell.
+       EPYTHON_ROOT="${T}/${EPYTHON}_root"
+       esetup.py install --root "${EPYTHON_ROOT}"
+
+       if [[ ${EPYTHON} == python2* ]]; then
+               # These tests just fail on Python 2.
+               EXCLUDE_TESTS=( or pep518_uses_build_env or 
install_package_with_root or install_editable_with_prefix
+                       or install_from_current_directory_into_usersite or 
install_user_wheel
+                       or uninstall_from_usersite_with_dist_in_global_site
+                       or uninstall_editable_from_usersite
+                       or build_env_isolation
+               )
+       fi
+
+       (
+               export PATH="${EPYTHON_ROOT}/usr/bin:$PATH"
+               export PYTHONPATH="${EPYTHON_ROOT}/$(python_get_sitedir)"
+
+               # Disable VCS and network tests.
+               # version_check tests are excluded since we explicitly disable 
this feature entirely.
+               # uninstall test just fails, likely because of our test 
environment setup.
+               python -m pytest -v \
+                       -n $(makeopts_jobs) \
+                       --timeout 300 \
+                       -k "not (svn or git or bazaar or mercurial or 
version_check or uninstall_non_local_distutils ${EXCLUDE_TESTS[*]})" \
+                       -m "not network" \
+                       || die
+       )
+}
+
+python_install_all() {
+       local DOCS=( AUTHORS.txt docs/html/**/*.rst )
+       distutils-r1_python_install_all
+
+       COMPLETION="${T}"/completion.tmp
+
+       # 'pip completion' command embeds full $0 into completion script, which 
confuses
+       # 'complete' and causes QA warning when running as "${PYTHON} -m pip".
+       # This trick sets correct $0 while still calling just installed pip.
+       local pipcmd='import sys; sys.argv[0] = "pip"; import pip.__main__; 
sys.exit(pip.__main__._main())'
+
+       ${PYTHON} -c "${pipcmd}" completion --bash > "${COMPLETION}" || die
+       newbashcomp "${COMPLETION}" ${PN}
+
+       ${PYTHON} -c "${pipcmd}" completion --zsh > "${COMPLETION}" || die
+       insinto /usr/share/zsh/site-functions
+       newins "${COMPLETION}" _pip
+}

Reply via email to