From f10b2ea1d7701c8771357c2fcf3296e2041250b4 Mon Sep 17 00:00:00 2001 From: Maxython Date: Thu, 12 Jan 2023 14:54:27 +0300 Subject: [PATCH] new package: python-pip --- packages/python-pip/build.sh | 51 +++++++++++++++++++ packages/python-pip/conf.py.patch | 14 +++++ ...ll_py_preventing_pip_from_installing.patch | 26 ++++++++++ 3 files changed, 91 insertions(+) create mode 100644 packages/python-pip/build.sh create mode 100644 packages/python-pip/conf.py.patch create mode 100644 packages/python-pip/install_py_preventing_pip_from_installing.patch diff --git a/packages/python-pip/build.sh b/packages/python-pip/build.sh new file mode 100644 index 0000000000..89235cba6a --- /dev/null +++ b/packages/python-pip/build.sh @@ -0,0 +1,51 @@ +TERMUX_PKG_VERSION=22.3.1 +TERMUX_PKG_HOMEPAGE=https://pip.pypa.io/ +TERMUX_PKG_DESCRIPTION="The PyPA recommended tool for installing Python packages" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_SRCURL=https://github.com/pypa/pip/archive/$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256=8d9f7cd8ad0d6f0c70e71704fd3f0f6538d70930454f1f21bbc2f8e94f6964ee +TERMUX_PKG_DEPENDS="python" +TERMUX_PKG_PLATFORM_INDEPENDENT=true +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_PYTHON_COMMON_DEPS="wheel, docutils, myst_parser, sphinx_copybutton, sphinx_inline_tabs, sphinxcontrib.towncrier, completion" + +termux_step_post_make_install() { + ( # creating pip documentation + cd docs/ + python pip_sphinxext.py + sphinx-build -b man -d build/doctrees/man man build/man -c html + ) + + install -vDm 644 LICENSE.txt -t "$TERMUX_PREFIX/share/licenses/python-pip/" + install -vDm 644 docs/build/man/*.1 -t "$TERMUX_PREFIX/share/man/man1/" + install -vDm 644 {NEWS,README}.rst -t "$TERMUX_PREFIX/share/doc/python-pip/" + + "$TERMUX_PREFIX"/bin/pip completion --bash | install -vDm 644 /dev/stdin "$TERMUX_PREFIX"/share/bash-completion/completions/pip + "$TERMUX_PREFIX"/bin/pip completion --fish | install -vDm 644 /dev/stdin "$TERMUX_PREFIX"/share/fish/vendor_completions.d/pip.fish +} + +termux_step_create_debscripts() { + # disable pip update notification + cat <<- POSTINST_EOF > ./postinst + #!$TERMUX_PREFIX/bin/bash + echo "pip setup..." + pip config set global.disable-pip-version-check true + exit 0 + POSTINST_EOF + if [ "$TERMUX_PACKAGE_FORMAT" = "pacman" ]; then + echo "post_install" > postupg + fi + + # deleting conf of pip while removing it + cat <<- PRERM_EOF > ./prerm + #!$TERMUX_PREFIX/bin/bash + if [ -d ~/.config/pip ]; then + echo "Removing the pip setting..." + rm -fr ~/.config/pip + fi + exit 0 + PRERM_EOF + + chmod 0755 postinst prerm +} diff --git a/packages/python-pip/conf.py.patch b/packages/python-pip/conf.py.patch new file mode 100644 index 0000000000..2b1a4ea5cd --- /dev/null +++ b/packages/python-pip/conf.py.patch @@ -0,0 +1,14 @@ +--- pip-22.3.1/docs/html/conf.py 2022-11-05 18:25:43.000000000 +0300 ++++ pip-22.3.1/docs/html/conf.py.patch 2022-12-01 18:27:35.429357992 +0300 +@@ -21,11 +21,6 @@ + "sphinx.ext.intersphinx", + # our extensions + "pip_sphinxext", +- # third-party extensions +- "myst_parser", +- "sphinx_copybutton", +- "sphinx_inline_tabs", +- "sphinxcontrib.towncrier", + ] + + # General information about the project. diff --git a/packages/python-pip/install_py_preventing_pip_from_installing.patch b/packages/python-pip/install_py_preventing_pip_from_installing.patch new file mode 100644 index 0000000000..d3319fd708 --- /dev/null +++ b/packages/python-pip/install_py_preventing_pip_from_installing.patch @@ -0,0 +1,26 @@ +diff -uNr pip-22.3.1/src/pip/_internal/commands/install.py pip-22.3.1/src/pip/_internal/commands/install.py.patch +--- pip-22.3.1/src/pip/_internal/commands/install.py 2022-11-05 18:25:43.000000000 +0300 ++++ pip-22.3.1/src/pip/_internal/commands/install.py.patch 2023-01-11 22:55:38.943540197 +0300 +@@ -346,6 +346,22 @@ + options, reqs, LegacySetupPyOptionsCheckMode.INSTALL + ) + ++ # This prevents updating pip via pip, which is necessary as it breaks ++ # the python-pip package in termux. ++ # https://github.com/termux/termux-packages/pull/13611#issuecomment-1336105506 ++ for req in reqs: ++ if req.name == "pip": ++ reqs.remove(req) ++ if len(reqs) == 0: ++ raise CommandError( ++ "Installing pip is forbidden, this will break the python-pip package (termux)." ++ ) ++ else: ++ logger.warning( ++ "Skip installing pip, this will break the python-pip package (termux)." ++ ) ++ break ++ + if "no-binary-enable-wheel-cache" in options.features_enabled: + # TODO: remove format_control from WheelCache when the deprecation cycle + # is over