|
| 1 | +# Distributed under the terms of the GNU General Public License v2 |
| 2 | + |
| 3 | +EAPI=7 |
| 4 | + |
| 5 | +PYTHON_COMPAT=( python3+ ) |
| 6 | +DISTUTILS_USE_SETUPTOOLS="rdepend" |
| 7 | +inherit bash-completion-r1 distutils-r1 |
| 8 | + |
| 9 | +DESCRIPTION="The PyPA recommended tool for installing Python packages." |
| 10 | +HOMEPAGE="None https://pypi.org/project/pip/" |
| 11 | +SRC_URI="https://files.pythonhosted.org/packages/59/de/241caa0ca606f2ec5fe0c1f4261b0465df78d786a38da693864a116c37f4/pip-25.1.1.tar.gz -> pip-25.1.1.tar.gz" |
| 12 | + |
| 13 | +DEPEND="" |
| 14 | +IUSE="vanilla" |
| 15 | +RESTRICT="test" |
| 16 | +SLOT="0" |
| 17 | +LICENSE="MIT" |
| 18 | +KEYWORDS="*" |
| 19 | +S="${WORKDIR}/pip-25.1.1" |
| 20 | + |
| 21 | +python_prepare_all() { |
| 22 | + if ! use vanilla; then |
| 23 | + # Running pip without --target, --prefix, --root, or --user will result |
| 24 | + # in packages being installed systemwide. This has a tendency to break |
| 25 | + # python-exec if setuptools gets installed or upgraded. |
| 26 | + sed -e 's|options.upgrade_strategy|options.upgrade_strategy\n\n if not options.use_user_site and not options.target_dir and not options.root_path and not options.prefix_path:\n raise CommandError("(Gentoo) Please run pip with the --user option to avoid breaking python-exec")\n|' \ |
| 27 | + -i src/pip/_internal/commands/install.py || die |
| 28 | + fi |
| 29 | + distutils-r1_python_prepare_all |
| 30 | +} |
| 31 | +python_install_all() { |
| 32 | + # Prevent dbus auto-launch |
| 33 | + # https://bugs.gentoo.org/692178 |
| 34 | + export DBUS_SESSION_BUS_ADDRESS="disabled:" |
| 35 | + local DOCS=( AUTHORS.txt docs/html/**/*.rst ) |
| 36 | + distutils-r1_python_install_all |
| 37 | + if [ "$PN" == "pip" ]; then |
| 38 | + COMPLETION="${T}"/completion.tmp |
| 39 | + # 'pip completion' command embeds full $0 into completion script, which confuses |
| 40 | + # 'complete' and causes QA warning when running as "${PYTHON} -m pip". |
| 41 | + # This trick sets correct $0 while still calling just installed pip. |
| 42 | + local pipcmd='import sys; sys.argv[0] = "pip"; __file__ = ""; from pip._internal.cli.main import main; sys.exit(main())' |
| 43 | + ${EPYTHON} -c "${pipcmd}" completion --bash > "${COMPLETION}" || die |
| 44 | + newbashcomp "${COMPLETION}" ${PN} |
| 45 | + ${EPYTHON} -c "${pipcmd}" completion --zsh > "${COMPLETION}" || die |
| 46 | + insinto /usr/share/zsh/site-functions |
| 47 | + newins "${COMPLETION}" _pip |
| 48 | + fi |
| 49 | +} |
0 commit comments