[arch-commits] Commit in python-pip/trunk (4 files)

David Runge dvzrv at gemini.archlinux.org
Mon Jun 27 14:53:32 UTC 2022


    Date: Monday, June 27, 2022 @ 14:53:32
  Author: dvzrv
Revision: 449489

upgpkg: python-pip 22.1.2-1: Upgrade to 22.1.2.

List all dependencies alphabetically.
Remove unneeded quotes and curly braces.
Add patch to enable devendoring.
Add (upstreamed) patch to add missing imports for python-rich when devendoring.
Remove unneeded patch for python-resolvelib.
Remove docs formerly used for python2 support.
Simplify setup for deselecting tests using a bash array.
Switch to PEP517.

Added:
  python-pip/trunk/pip-22.1.2-devendor.patch
  python-pip/trunk/pip-22.1.2-devendor_imports.patch
Modified:
  python-pip/trunk/PKGBUILD
Deleted:
  python-pip/trunk/resolvelib-0.5.5.patch

-----------------------------------+
 PKGBUILD                          |  175 ++++++++++++++++++++++--------------
 pip-22.1.2-devendor.patch         |   12 ++
 pip-22.1.2-devendor_imports.patch |   21 ++++
 resolvelib-0.5.5.patch            |   45 ---------
 4 files changed, 141 insertions(+), 112 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-06-27 14:46:09 UTC (rev 449488)
+++ PKGBUILD	2022-06-27 14:53:32 UTC (rev 449489)
@@ -1,94 +1,135 @@
-# Maintainer: Dan McGee <dan at archlinux.org>
+# Maintainer: David Runge <dvzrv at archlinux.org>
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Dan McGee <dan at archlinux.org>
 # Contributor: Eli Schwartz <eschwartz at archlinux.org>
 # Contributor: Sebastien Binet <binet at lblbox>
 
+_name=pip
 pkgname=python-pip
-pkgver=21.0
+pkgver=22.1.2
 pkgrel=1
 pkgdesc="The PyPA recommended tool for installing Python packages"
 url="https://pip.pypa.io/"
-arch=('any')
-license=('MIT')
-_deps=('appdirs' 'cachecontrol' 'colorama' 'contextlib2' 'distlib' 'distro' 'html5lib'
-       'packaging' 'pep517' 'progress' 'requests' 'retrying' 'resolvelib' 'setuptools' 'six' 'toml'
-       # add these until https://github.com/pypa/pip/issues/5354#issuecomment-672678167 is resolved
-       'pyopenssl')
-depends=("${_deps[@]/#/python-}")
-makedepends=("${_deps[@]/#/python-}" 'python-sphinx'
-             'python-sphinx-inline-tabs' 'python-sphinxcontrib-towncrier')
-checkdepends=('python-pytest-runner' 'python-scripttest' 'python-virtualenv' 'python-pretend'
-              'python-yaml' 'python-mock' 'python-freezegun' 'python-cryptography' 'python-pip'
-              'python-wheel' 'python-werkzeug' 'python-csv23' 'git' 'subversion')
-source=("pip-${pkgver}.tar.gz::https://github.com/pypa/pip/archive/${pkgver}.tar.gz"
-        resolvelib-0.5.5.patch)
-sha512sums=('ac77a7204423f1fdc3a4d328dab1860258efccde0123cff3217f357637c4ce3d85772ab81a230122ff813be2cfa40f2862e5d499390289efe1dcde3a31a42264'
-            'f339a20e965c583c1dc741d9fff90749aab049d591f0ac974e2187d4f41842661802b96266e8e35454b65d61d65c337a770d58b81119af07483fde0eda48001b')
+arch=(any)
+license=(MIT)
+# packages required to devendor pip: https://github.com/pypa/pip/tree/main/src/pip/_vendor
+_vendored=(
+  python-cachecontrol
+  python-certifi
+  python-chardet
+  python-colorama
+  python-distlib
+  python-distro
+  python-html5lib
+  python-idna
+  python-msgpack
+  python-packaging
+  python-pep517
+  python-platformdirs
+  python-pygments
+  python-pyparsing
+  python-requests
+  python-resolvelib
+  python-rich
+  python-setuptools
+  python-six
+  python-tenacity
+  python-tomli
+  python-typing-extensions
+  python-urllib3
+  python-webencodings
+)
+# add these until https://github.com/pypa/pip/issues/5354#issuecomment-672678167 is resolved
+_vendored_optional=(
+  python-pyopenssl
+)
+depends=("${_vendored[@]}" "${_vendored_optional[@]}")
+makedepends=(
+  python-build
+  python-installer
+  python-myst-parser
+  python-setuptools
+  python-sphinx
+  python-sphinx-copybutton
+  python-sphinx-inline-tabs
+  python-sphinxcontrib-towncrier
+  python-wheel
+)
+checkdepends=(
+  git
+  python-cryptography
+  python-freezegun
+  python-pytest
+  python-pytest-rerunfailures
+  python-pytest-xdist
+  python-scripttest
+  python-setuptools
+  python-tomli-w
+  python-virtualenv
+  python-werkzeug
+  python-wheel
+  subversion
+)
+source=(
+  $_name-$pkgver.tar.gz::https://github.com/pypa/$_name/archive/$pkgver.tar.gz
+  $_name-22.1.2-devendor.patch
+  $_name-22.1.2-devendor_imports.patch
+)
+sha512sums=('7dd13150023f1cca8f5e01da7688ae418b5d0b36364efcfc15374a5147c7cabd46ff1d34e6499bc8e182dc0d34a366f5fe21d8ab4de4d112d269a97200401305'
+            '90f07252786d765c8ba7ce12915ed9434d3696addb8e5cfff298f280b9f499ad6836a158c9f515a51fc7373f1a77b9eb550b7855609114b041aa7bc5b2b821ae'
+            '5abdd74c505f649e381c807607c98edeab45671ca48bb7d99fc85d35191bbe7addbcadb4b833d8851095896433a8860a703c80e120a15038afb234448cea514d')
+b2sums=('f709f8977d467d5a3170884bb75cd2f74a2f40801ae02a3725d442e18e4073f9c4a39cd1c9d2ce3949eb888be69d151f67d0cf2d0cbad7e2ec1ec6e78150b5c7'
+        '892455034738c6c7a74cd7c136c0650f9c4eb54dd4708cf43d2e17ecbd9904adb567c9c3d5a05865048645ad3aac65406a82d23af43fd3889d9290b66d89ead5'
+        '256b5cc8b0f91265965ca90f443033f540fc698fca981cc9b30fbba60fcc9a82b2f7acfabb807db0911677f5a50ad3387879adf6ee21b6029cad47ed2abe7ebd')
 
 shopt -s extglob
 prepare() {
-  cd pip-$pkgver
+  # set DEBUNDLED to True
+  patch -Np1 -d $_name-$pkgver -i ../$_name-22.1.2-devendor.patch
+  # add missing imports for rich for devendoring: https://github.com/pypa/pip/pull/11211
+  patch -Np1 -d $_name-$pkgver -i ../$_name-22.1.2-devendor_imports.patch
 
-  # Backported from:
-  # https://github.com/pypa/pip/commit/0d39ae9734d054c25e48e2da7ddb76545e5de330
-  patch -p1 -i ../resolvelib-0.5.5.patch
-
-  # Remove certifi usage
-  sed -i 's|from pip._vendor.certifi import where|where = lambda: "/etc/ssl/certs/ca-certificates.crt"|' src/pip/_internal/commands/debug.py
-
-  rm -rf src/pip/_vendor/!(__init__.py)
-  sed -i -e 's/DEBUNDLED = False/DEBUNDLED = True/' \
-            src/pip/_vendor/__init__.py
+  # remove vendored files, except __init__.py
+  rm -frv $_name-$pkgver/src/pip/_vendor/!(__init__.py)
+  shopt -u extglob
 }
 
 build() {
-  cd pip-$pkgver
+  cd $_name-$pkgver
 
-  python setup.py build
+  python -m build --wheel --no-isolation
 
   cd docs/
-  PYTHONPATH="$srcdir/pip-$pkgver/src/" python pip_sphinxext.py
-  PYTHONPATH="$srcdir/pip-$pkgver/src/" sphinx-build -W -b man -d build/doctrees/man man build/man -c html
-  mkdir -p build/man-pip2
-  cd build/man
-  for manfile in *; do
-    sed 's/pip/pip2/g;s/PIP/PIP2/g' $manfile > ../man-pip2/${manfile/pip/pip2}
-  done
+  PYTHONPATH="$srcdir/$_name-$pkgver/src/" python pip_sphinxext.py
+  PYTHONPATH="$srcdir/$_name-$pkgver/src/" sphinx-build -b man -d build/doctrees/man man build/man -c html
 }
 
 check() {
-  cd "$srcdir"/pip-$pkgver
-  pip wheel -w tests/data/common_wheels -r tools/requirements/tests-common_wheels.txt
-  python setup.py install --root="$PWD/tmp_install" --optimize=1
-  # appdirs: https://github.com/pypa/pip/issues/7784
-  # build_env: TODO weird looking errors
-  # virtualenv: https://github.com/pypa/pip/issues/8273
-  PYTHONPATH="$PWD/tmp_install/usr/lib/python3.10/site-packages" PATH="$PWD/tmp_install/usr/bin:$PATH" \
-    python -m pytest -m unit --junit-xml=junit/unit-test.xml --deselect tests/unit/test_appdirs.py::TestSiteConfigDirs::test_site_config_dirs_linux \
-                                                             --deselect tests/unit/test_appdirs.py::TestSiteConfigDirs::test_site_config_dirs_linux_override \
-                                                             --deselect tests/unit/test_appdirs.py::TestSiteConfigDirs::test_site_config_dirs_linux_empty \
-                                                             --deselect tests/unit/test_appdirs.py::TestUserDataDir::test_user_data_dir_osx \
-                                                             --deselect tests/unit/test_appdirs.py::TestUserConfigDir::test_user_config_dir_osx \
-                                                             --deselect tests/unit/test_build_env.py::test_build_env_requirements_check \
-                                                             --deselect tests/unit/test_build_env.py::test_build_env_overlay_prefix_has_priority \
-                                                             --deselect tests/unit/test_build_env.py::test_build_env_isolation \
-                                                             --deselect tests/unit/test_build_env.py::test_build_env_allow_only_one_install \
-                                                             --deselect tests/unit/test_direct_url_helpers.py::test_from_link_vcs_with_source_dir_obtains_commit_id \
-                                                             --deselect tests/unit/test_direct_url_helpers.py::test_from_link_vcs_without_source_dir \
-                                                             --deselect tests/unit/test_wheel_builder.py::test_should_cache_git_sha \
-                                                             --deselect tests/unit/resolution_resolvelib/test_requirement.py::test_new_resolver_full_resolve
+  local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
+  local _deselected=(
+    # deselect tests that would require python-pip in checkdepends (may or may not work due to devendored dependencies when python-pip is updated)
+    --deselect tests/unit/test_direct_url_helpers.py::test_from_link_vcs_with_source_dir_obtains_commit_id
+    --deselect tests/unit/test_direct_url_helpers.py::test_from_link_vcs_without_source_dir
+    --deselect tests/unit/test_wheel_builder.py::test_should_cache_git_sha
+  )
+
+  cd $_name-$pkgver
+  # install to temporary location
+  python -m installer --destdir=test_dir dist/*.whl
+  export PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH"
+  pytest -vv -m unit "${_deselected[@]}"
 }
 
 package() {
-  cd pip-$pkgver
-  python setup.py install --prefix=/usr --root="$pkgdir"
+  local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
 
-  install -D -m644 LICENSE.txt \
-	  "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+  cd $_name-$pkgver
+  python -m installer --destdir="$pkgdir" dist/*.whl
 
-  install -Dm644 -t "$pkgdir"/usr/share/man/man1 docs/build/man/*
+  install -vDm 644 LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
+  install -vDm 644 docs/build/man/*.1 -t "$pkgdir/usr/share/man/man1/"
 
-  PYTHONPATH="$pkgdir"/usr/lib/python3.10/site-packages "$pkgdir"/usr/bin/pip completion --bash \
-    | install -Dm644 /dev/stdin "$pkgdir"/usr/share/bash-completion/completions/pip
-  PYTHONPATH="$pkgdir"/usr/lib/python3.10/site-packages "$pkgdir"/usr/bin/pip completion --fish \
-    | install -Dm644 /dev/stdin "$pkgdir"/usr/share/fish/vendor_completions.d/pip.fish
+  # NOTE: zsh completion does not work: https://bugs.archlinux.org/task/65349#comment187166
+  PYTHONPATH="$pkgdir/$_site_packages" "$pkgdir"/usr/bin/pip completion --bash | install -vDm 644 /dev/stdin "$pkgdir"/usr/share/bash-completion/completions/pip
+  PYTHONPATH="$pkgdir/$_site_packages" "$pkgdir"/usr/bin/pip completion --fish | install -vDm 644 /dev/stdin "$pkgdir"/usr/share/fish/vendor_completions.d/pip.fish
 }

Added: pip-22.1.2-devendor.patch
===================================================================
--- pip-22.1.2-devendor.patch	                        (rev 0)
+++ pip-22.1.2-devendor.patch	2022-06-27 14:53:32 UTC (rev 449489)
@@ -0,0 +1,12 @@
+diff -ruN a/src/pip/_vendor/__init__.py b/src/pip/_vendor/__init__.py
+--- a/src/pip/_vendor/__init__.py	2022-05-31 13:05:52.000000000 +0200
++++ b/src/pip/_vendor/__init__.py	2022-06-27 13:03:22.909131639 +0200
+@@ -14,7 +14,7 @@
+ # Downstream redistributors which have debundled our dependencies should also
+ # patch this value to be true. This will trigger the additional patching
+ # to cause things like "six" to be available as pip.
+-DEBUNDLED = False
++DEBUNDLED = True
+ 
+ # By default, look in this directory for a bunch of .whl files which we will
+ # add to the beginning of sys.path before attempting to import anything. This

Added: pip-22.1.2-devendor_imports.patch
===================================================================
--- pip-22.1.2-devendor_imports.patch	                        (rev 0)
+++ pip-22.1.2-devendor_imports.patch	2022-06-27 14:53:32 UTC (rev 449489)
@@ -0,0 +1,21 @@
+diff --git c/src/pip/_vendor/__init__.py w/src/pip/_vendor/__init__.py
+index 3843cb099..39579aa96 100644
+--- c/src/pip/_vendor/__init__.py
++++ w/src/pip/_vendor/__init__.py
+@@ -106,6 +106,16 @@ if DEBUNDLED:
+     vendored("requests.packages.urllib3.util.timeout")
+     vendored("requests.packages.urllib3.util.url")
+     vendored("resolvelib")
++    vendored("rich")
++    vendored("rich.console")
++    vendored("rich.highlighter")
++    vendored("rich.logging")
++    vendored("rich.markup")
++    vendored("rich.progress")
++    vendored("rich.segment")
++    vendored("rich.style")
++    vendored("rich.text")
++    vendored("rich.traceback")
+     vendored("tenacity")
+     vendored("tomli")
+     vendored("urllib3")

Deleted: resolvelib-0.5.5.patch
===================================================================
--- resolvelib-0.5.5.patch	2022-06-27 14:46:09 UTC (rev 449488)
+++ resolvelib-0.5.5.patch	2022-06-27 14:53:32 UTC (rev 449489)
@@ -1,45 +0,0 @@
-From 0d39ae9734d054c25e48e2da7ddb76545e5de330 Mon Sep 17 00:00:00 2001
-From: Tzu-ping Chung <uranusjr at gmail.com>
-Date: Tue, 9 Mar 2021 05:20:23 +0800
-Subject: [PATCH] Pull in resolvelib's typing information
-
----
- .../resolution/resolvelib/factory.py          |  9 ++-
- .../resolution/resolvelib/provider.py         | 24 ++++--
- .../resolution/resolvelib/resolver.py         | 25 +++++--
- src/pip/_vendor/resolvelib.pyi                |  1 -
- src/pip/_vendor/resolvelib/__init__.py        |  2 +-
- src/pip/_vendor/resolvelib/__init__.pyi       | 15 ++++
- src/pip/_vendor/resolvelib/providers.py       |  8 +-
- src/pip/_vendor/resolvelib/providers.pyi      | 44 +++++++++++
- src/pip/_vendor/resolvelib/py.typed           |  0
- src/pip/_vendor/resolvelib/reporters.pyi      | 10 +++
- src/pip/_vendor/resolvelib/resolvers.py       | 39 +++++-----
- src/pip/_vendor/resolvelib/resolvers.pyi      | 73 +++++++++++++++++++
- src/pip/_vendor/resolvelib/structs.pyi        | 35 +++++++++
- src/pip/_vendor/vendor.txt                    |  2 +-
- 14 files changed, 242 insertions(+), 45 deletions(-)
- delete mode 100644 src/pip/_vendor/resolvelib.pyi
- create mode 100644 src/pip/_vendor/resolvelib/__init__.pyi
- create mode 100644 src/pip/_vendor/resolvelib/providers.pyi
- create mode 100644 src/pip/_vendor/resolvelib/py.typed
- create mode 100644 src/pip/_vendor/resolvelib/reporters.pyi
- create mode 100644 src/pip/_vendor/resolvelib/resolvers.pyi
- create mode 100644 src/pip/_vendor/resolvelib/structs.pyi
-
-diff --git a/src/pip/_internal/resolution/resolvelib/provider.py b/src/pip/_internal/resolution/resolvelib/provider.py
-index 2085a0714a3..cd2ccfa60a3 100644
---- a/src/pip/_internal/resolution/resolvelib/provider.py
-+++ b/src/pip/_internal/resolution/resolvelib/provider.py
-@@ -50,9 +50,9 @@ def __init__(
-         self._upgrade_strategy = upgrade_strategy
-         self._user_requested = user_requested
- 
--    def identify(self, dependency):
-+    def identify(self, requirement_or_candidate):
-         # type: (Union[Requirement, Candidate]) -> str
--        return dependency.name
-+        return requirement_or_candidate.name
- 
-     def get_preference(
-         self,



More information about the arch-commits mailing list