1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 python3_{6,7} pypy3 )
7 PYTHON_REQ_USE="ssl(+),threads(+)"
9 inherit bash-completion-r1 distutils-r1 multiprocessing
11 SETUPTOOLS_PV="41.0.1"
14 DESCRIPTION="Installs python packages -- replacement for easy_install"
15 HOMEPAGE="https://pip.pypa.io/ https://pypi.org/project/pip/ https://github.com/pypa/pip/"
17 https://github.com/pypa/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz
19 https://files.pythonhosted.org/packages/py2.py3/s/setuptools/setuptools-${SETUPTOOLS_PV}-py2.py3-none-any.whl
20 https://files.pythonhosted.org/packages/py2.py3/w/wheel/wheel-${WHEEL_PV}-py2.py3-none-any.whl
23 # PyPI archive does not have tests, so we need to download from GitHub.
24 # setuptools & wheel .whl files are required for testing, exact version is not very important.
31 # disable-system-install patch breaks tests
32 RESTRICT="!vanilla? ( test ) !test? ( test )"
35 >=dev-python/setuptools-39.2.0[${PYTHON_USEDEP}]
40 dev-python/freezegun[${PYTHON_USEDEP}]
41 dev-python/mock[${PYTHON_USEDEP}]
42 dev-python/pretend[${PYTHON_USEDEP}]
43 <dev-python/pytest-4[${PYTHON_USEDEP}]
44 dev-python/pytest-cov[${PYTHON_USEDEP}]
45 <dev-python/pytest-rerunfailures-7.0[${PYTHON_USEDEP}]
46 dev-python/pytest-timeout[${PYTHON_USEDEP}]
47 <dev-python/pytest-xdist-1.28.0[${PYTHON_USEDEP}]
48 dev-python/pyyaml[${PYTHON_USEDEP}]
49 dev-python/scripttest[${PYTHON_USEDEP}]
50 dev-python/wheel[${PYTHON_USEDEP}]
54 python_prepare_all() {
56 "${FILESDIR}/${PN}-19.1-disable-version-check.patch"
58 if ! use vanilla; then
59 PATCHES+=( "${FILESDIR}/pip-19.1-disable-system-install.patch" )
61 distutils-r1_python_prepare_all
64 mkdir tests/data/common_wheels/
65 cp "${DISTDIR}"/setuptools-${SETUPTOOLS_PV}-py2.py3-none-any.whl tests/data/common_wheels/ || die
66 cp "${DISTDIR}"/wheel-${WHEEL_PV}-py2.py3-none-any.whl tests/data/common_wheels/ || die
71 # Exclude tests that fail for some reason. Some of these failures may be Gentoo-specific.
75 -k "not (svn or git or bazaar or mercurial or test_pep518_uses_build_env or test_install_package_with_root or test_install_editable_with_prefix or install_from_user or install_user_conflict or upgrade_user_conflict or build_env_isolation or config_file_venv_option or get_legacy_build_wheel or install_user_wheel or uninstall_non_local_distutils or install_from_current_directory_into_usersite or uninstall_editable_from_usersite)" \
80 python_install_all() {
81 local DOCS=( AUTHORS.txt docs/html/**/*.rst )
82 distutils-r1_python_install_all
84 COMPLETION="${T}"/completion.tmp
86 # 'pip completion' command embeds full $0 into completion script, which confuses
87 # 'complete' and causes QA warning when running as "${PYTHON} -m pip".
88 # This trick sets correct $0 while still calling just installed pip.
89 local pipcmd='import sys; sys.argv[0] = "pip"; import pip.__main__; sys.exit(pip.__main__._main())'
91 ${PYTHON} -c "${pipcmd}" completion --bash > "${COMPLETION}" || die
92 newbashcomp "${COMPLETION}" ${PN}
94 ${PYTHON} -c "${pipcmd}" completion --zsh > "${COMPLETION}" || die
95 insinto /usr/share/zsh/site-functions
96 newins "${COMPLETION}" _pip