From 9e88e8708fbb472c121d0272a85faa87d55434d4 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 28 Aug 2021 18:05:37 -0700 Subject: [PATCH 01/15] Replace assert_raises_regexp function with pytest.raises These methods serve the same purpose. Can shift to using the upstream implementation. https://docs.pytest.org/en/latest/reference/reference.html#pytest.raises --- ...10-7f57-4fda-b17a-d1a6aa873e8e.trivial.rst | 0 tests/lib/__init__.py | 13 -- tests/unit/test_req.py | 112 +++++++++--------- 3 files changed, 56 insertions(+), 69 deletions(-) create mode 100644 news/e0fbc910-7f57-4fda-b17a-d1a6aa873e8e.trivial.rst diff --git a/news/e0fbc910-7f57-4fda-b17a-d1a6aa873e8e.trivial.rst b/news/e0fbc910-7f57-4fda-b17a-d1a6aa873e8e.trivial.rst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/lib/__init__.py b/tests/lib/__init__.py index 94533309fa8..18d6aa3db3b 100644 --- a/tests/lib/__init__.py +++ b/tests/lib/__init__.py @@ -991,19 +991,6 @@ def _change_test_package_version(script, version_pkg_path): _git_commit(script, version_pkg_path, message="messed version", stage_modified=True) -def assert_raises_regexp(exception, reg, run, *args, **kwargs): - """Like assertRaisesRegexp in unittest""" - __tracebackhide__ = True - - try: - run(*args, **kwargs) - assert False, f"{exception} should have been thrown" - except exception: - e = sys.exc_info()[1] - p = re.compile(reg) - assert p.search(str(e)), str(e) - - @contextmanager def requirements_file(contents, tmpdir): """Return a Path to a requirements file of given contents. diff --git a/tests/unit/test_req.py b/tests/unit/test_req.py index f4c1d48d93f..f6f552a8fe7 100644 --- a/tests/unit/test_req.py +++ b/tests/unit/test_req.py @@ -38,7 +38,7 @@ from pip._internal.req.req_tracker import get_requirement_tracker from pip._internal.resolution.legacy.resolver import Resolver from pip._internal.utils.urls import path_to_url -from tests.lib import assert_raises_regexp, make_test_finder, requirements_file +from tests.lib import make_test_finder, requirements_file def get_processed_req_from_line(line, fname="file", lineno=1): @@ -117,15 +117,15 @@ def test_no_reuse_existing_build_dir(self, data): reqset.add_requirement(req) finder = make_test_finder(find_links=[data.find_links]) with self._basic_resolver(finder) as resolver: - assert_raises_regexp( + with pytest.raises( PreviousBuildDirError, - r"pip can't proceed with [\s\S]*{req}[\s\S]*{build_dir_esc}".format( - build_dir_esc=build_dir.replace("\\", "\\\\"), req=req + match=( + r"pip can't proceed with [\s\S]*{req}[\s\S]*{build_dir_esc}".format( + build_dir_esc=build_dir.replace("\\", "\\\\"), req=req + ) ), - resolver.resolve, - reqset.all_requirements, - True, - ) + ): + resolver.resolve(reqset.all_requirements, True) def test_environment_marker_extras(self, data): """ @@ -151,16 +151,16 @@ def test_missing_hash_with_require_hashes(self, data): finder = make_test_finder(find_links=[data.find_links]) with self._basic_resolver(finder, require_hashes=True) as resolver: - assert_raises_regexp( + with pytest.raises( HashErrors, - r"Hashes are required in --require-hashes mode, but they are " - r"missing .*\n" - r" simple==1.0 --hash=sha256:393043e672415891885c9a2a0929b1" - r"af95fb866d6ca016b42d2e6ce53619b653$", - resolver.resolve, - reqset.all_requirements, - True, - ) + match=( + r"Hashes are required in --require-hashes mode, but they are " + r"missing .*\n" + r" simple==1.0 --hash=sha256:393043e672415891885c9a2a0929b1" + r"af95fb866d6ca016b42d2e6ce53619b653$" + ), + ): + resolver.resolve(reqset.all_requirements, True) def test_missing_hash_with_require_hashes_in_reqs_file(self, data, tmpdir): """--require-hashes in a requirements file should make its way to the @@ -203,20 +203,20 @@ def test_unsupported_hashes(self, data): sep = "\\\\" # This needs to be escaped for the regex with self._basic_resolver(finder, require_hashes=True) as resolver: - assert_raises_regexp( + with pytest.raises( HashErrors, - r"Can't verify hashes for these requirements because we don't " - r"have a way to hash version control repositories:\n" - r" git\+git://github\.com/pypa/pip-test-package \(from -r " - r"file \(line 1\)\)\n" - r"Can't verify hashes for these file:// requirements because " - r"they point to directories:\n" - r" file://.*{sep}data{sep}packages{sep}FSPkg " - r"\(from -r file \(line 2\)\)".format(sep=sep), - resolver.resolve, - reqset.all_requirements, - True, - ) + match=( + r"Can't verify hashes for these requirements because we don't " + r"have a way to hash version control repositories:\n" + r" git\+git://github\.com/pypa/pip-test-package \(from -r " + r"file \(line 1\)\)\n" + r"Can't verify hashes for these file:// requirements because " + r"they point to directories:\n" + r" file://.*{sep}data{sep}packages{sep}FSPkg " + r"\(from -r file \(line 2\)\)".format(sep=sep) + ), + ): + resolver.resolve(reqset.all_requirements, True) def test_unpinned_hash_checking(self, data): """Make sure prepare_files() raises an error when a requirement is not @@ -241,16 +241,16 @@ def test_unpinned_hash_checking(self, data): ) finder = make_test_finder(find_links=[data.find_links]) with self._basic_resolver(finder, require_hashes=True) as resolver: - assert_raises_regexp( + with pytest.raises( HashErrors, # Make sure all failing requirements are listed: - r"versions pinned with ==. These do not:\n" - r" simple .* \(from -r file \(line 1\)\)\n" - r" simple2>1.0 .* \(from -r file \(line 2\)\)", - resolver.resolve, - reqset.all_requirements, - True, - ) + match=( + r"versions pinned with ==. These do not:\n" + r" simple .* \(from -r file \(line 1\)\)\n" + r" simple2>1.0 .* \(from -r file \(line 2\)\)" + ), + ): + resolver.resolve(reqset.all_requirements, True) def test_hash_mismatch(self, data): """A hash mismatch should raise an error.""" @@ -264,17 +264,17 @@ def test_hash_mismatch(self, data): ) finder = make_test_finder(find_links=[data.find_links]) with self._basic_resolver(finder, require_hashes=True) as resolver: - assert_raises_regexp( + with pytest.raises( HashErrors, - r"THESE PACKAGES DO NOT MATCH THE HASHES.*\n" - r" file:///.*/data/packages/simple-1\.0\.tar\.gz .*:\n" - r" Expected sha256 badbad\n" - r" Got 393043e672415891885c9a2a0929b1af95fb" - r"866d6ca016b42d2e6ce53619b653$", - resolver.resolve, - reqset.all_requirements, - True, - ) + match=( + r"THESE PACKAGES DO NOT MATCH THE HASHES.*\n" + r" file:///.*/data/packages/simple-1\.0\.tar\.gz .*:\n" + r" Expected sha256 badbad\n" + r" Got 393043e672415891885c9a2a0929b1af95fb" + r"866d6ca016b42d2e6ce53619b653$" + ), + ): + resolver.resolve(reqset.all_requirements, True) def test_unhashed_deps_on_require_hashes(self, data): """Make sure unhashed, unpinned, or otherwise unrepeatable @@ -291,15 +291,15 @@ def test_unhashed_deps_on_require_hashes(self, data): ) with self._basic_resolver(finder, require_hashes=True) as resolver: - assert_raises_regexp( + with pytest.raises( HashErrors, - r"In --require-hashes mode, all requirements must have their " - r"versions pinned.*\n" - r" TopoRequires from .*$", - resolver.resolve, - reqset.all_requirements, - True, - ) + match=( + r"In --require-hashes mode, all requirements must have their " + r"versions pinned.*\n" + r" TopoRequires from .*$" + ), + ): + resolver.resolve(reqset.all_requirements, True) def test_hashed_deps_on_require_hashes(self): """Make sure hashed dependencies get installed when --require-hashes From a4cb77ffd034f0669ffeba2e6ae438f0538f58ff Mon Sep 17 00:00:00 2001 From: meowmeowcat Date: Sat, 4 Sep 2021 13:08:53 +0800 Subject: [PATCH 02/15] Update links of setuptools --- docs/html/cli/pip_install.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/html/cli/pip_install.rst b/docs/html/cli/pip_install.rst index 2403f8370cb..bd7854a1c8a 100644 --- a/docs/html/cli/pip_install.rst +++ b/docs/html/cli/pip_install.rst @@ -379,7 +379,7 @@ Finding Packages pip searches for packages on `PyPI`_ using the `HTTP simple interface `_, -which is documented `here `_ +which is documented `here `_ and `there `_. pip offers a number of package index options for modifying how packages are @@ -620,7 +620,7 @@ option in pip's command line. ^^^^^^^^^^^^^^^^^^^ "Editable" installs are fundamentally `"setuptools develop mode" -`_ +`_ installs. You can install local projects or VCS projects in "editable" mode: @@ -653,7 +653,7 @@ Controlling setup_requires -------------------------- Setuptools offers the ``setup_requires`` `setup() keyword -`_ +`_ for specifying dependencies that need to be present in order for the ``setup.py`` script to run. Internally, Setuptools uses ``easy_install`` to fulfill these dependencies. @@ -693,7 +693,7 @@ the following commands:: The ``egg_info`` command should create egg metadata for the package, as described in the setuptools documentation at -https://setuptools.readthedocs.io/en/latest/setuptools.html#egg-info-create-egg-metadata-and-set-build-tags +https://setuptools.readthedocs.io/en/latest/userguide/commands.html#egg-info-create-egg-metadata-and-set-build-tags The ``install`` command should implement the complete process of installing the package to the target directory XXX. From 1f817dcdcabb9a4c0359c9c384e0586dbcb57f91 Mon Sep 17 00:00:00 2001 From: meowmeowcat Date: Sat, 4 Sep 2021 13:17:41 +0800 Subject: [PATCH 03/15] Update a link of setuptools --- docs/html/user_guide.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/html/user_guide.rst b/docs/html/user_guide.rst index e46e7a54ad7..a513718bf79 100644 --- a/docs/html/user_guide.rst +++ b/docs/html/user_guide.rst @@ -180,7 +180,7 @@ In practice, there are 4 common uses of Requirements files: It's important to be clear that pip determines package dependencies using `install_requires metadata -`_, +`_, not by discovering ``requirements.txt`` files embedded in projects. See also: From 95145c19d18c8caabc09bedbacd6a9a3104f19bc Mon Sep 17 00:00:00 2001 From: Damian Shaw Date: Sat, 4 Sep 2021 19:45:19 -0400 Subject: [PATCH 04/15] Fix known depths --- src/pip/_internal/resolution/resolvelib/provider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pip/_internal/resolution/resolvelib/provider.py b/src/pip/_internal/resolution/resolvelib/provider.py index 632854d3bc5..a3250b35161 100644 --- a/src/pip/_internal/resolution/resolvelib/provider.py +++ b/src/pip/_internal/resolution/resolvelib/provider.py @@ -112,9 +112,9 @@ def get_preference( for _, parent in information[identifier] ) inferred_depth = min(d for d in parent_depths) + 1.0 - self._known_depths[identifier] = inferred_depth else: inferred_depth = 1.0 + self._known_depths[identifier] = inferred_depth requested_order = self._user_requested.get(identifier, math.inf) From d925e248366a6d8a1fcf1a83b413b1077cc3171f Mon Sep 17 00:00:00 2001 From: meowmeowcat Date: Sun, 5 Sep 2021 12:24:08 +0800 Subject: [PATCH 05/15] Link to PyPUG instead of Setuptools --- docs/html/cli/pip_install.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/html/cli/pip_install.rst b/docs/html/cli/pip_install.rst index bd7854a1c8a..1362b490ba3 100644 --- a/docs/html/cli/pip_install.rst +++ b/docs/html/cli/pip_install.rst @@ -379,7 +379,7 @@ Finding Packages pip searches for packages on `PyPI`_ using the `HTTP simple interface `_, -which is documented `here `_ +which is documented `here `_ and `there `_. pip offers a number of package index options for modifying how packages are From 8d4e075cfae500f149806653142794cebd80372a Mon Sep 17 00:00:00 2001 From: meowmeowcat <68463158+meowmeowmeowcat@users.noreply.github.com> Date: Sun, 5 Sep 2021 15:50:51 +0800 Subject: [PATCH 06/15] Add news fragment --- news/10430.doc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/10430.doc.rst diff --git a/news/10430.doc.rst b/news/10430.doc.rst new file mode 100644 index 00000000000..16385142183 --- /dev/null +++ b/news/10430.doc.rst @@ -0,0 +1 @@ +Update links of setuptools \ No newline at end of file From 5144fbfa2cd219118edf98b5ab808c0d0a9dcf06 Mon Sep 17 00:00:00 2001 From: meowmeowcat Date: Sun, 5 Sep 2021 16:07:06 +0800 Subject: [PATCH 07/15] Add more information --- news/10430.doc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/10430.doc.rst b/news/10430.doc.rst index 16385142183..32007cfb1e0 100644 --- a/news/10430.doc.rst +++ b/news/10430.doc.rst @@ -1 +1 @@ -Update links of setuptools \ No newline at end of file +Update links of setuptools as setuptools moved these documents. The Simple Repository link now points to PyPUG as that is the canonical place of packaging specification, and setuptools's `easy_install` is deprecated. From c5a1048aa4c41214d7b3384a94c73cacf14656f2 Mon Sep 17 00:00:00 2001 From: meowmeowcat Date: Sun, 5 Sep 2021 17:53:50 +0800 Subject: [PATCH 08/15] Fix linting error --- news/10430.doc.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/10430.doc.rst b/news/10430.doc.rst index 32007cfb1e0..89610b84ac3 100644 --- a/news/10430.doc.rst +++ b/news/10430.doc.rst @@ -1 +1 @@ -Update links of setuptools as setuptools moved these documents. The Simple Repository link now points to PyPUG as that is the canonical place of packaging specification, and setuptools's `easy_install` is deprecated. +Update links of setuptools as setuptools moved these documents. The Simple Repository link now points to PyPUG as that is the canonical place of packaging specification, and setuptools's ``easy_install`` is deprecated. From ca724eff0bcd10105276de0bcb5a4059a60d6e77 Mon Sep 17 00:00:00 2001 From: Damian Shaw Date: Sat, 4 Sep 2021 19:45:19 -0400 Subject: [PATCH 09/15] Fix known depths --- src/pip/_internal/resolution/resolvelib/provider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pip/_internal/resolution/resolvelib/provider.py b/src/pip/_internal/resolution/resolvelib/provider.py index 632854d3bc5..a3250b35161 100644 --- a/src/pip/_internal/resolution/resolvelib/provider.py +++ b/src/pip/_internal/resolution/resolvelib/provider.py @@ -112,9 +112,9 @@ def get_preference( for _, parent in information[identifier] ) inferred_depth = min(d for d in parent_depths) + 1.0 - self._known_depths[identifier] = inferred_depth else: inferred_depth = 1.0 + self._known_depths[identifier] = inferred_depth requested_order = self._user_requested.get(identifier, math.inf) From 8c5d3556bdb4bf75e68adf23beaada35a7461268 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Tue, 7 Sep 2021 20:36:31 -0700 Subject: [PATCH 10/15] Fix failing test due to removed setuptools feature, use_2to3 setuptools removed use_2to3 in version v58.0.1 (2021-09-06). Some tests install the anyjson package which uses this feature and so those tests result in a command failure. The failure appeared as: error in anyjson setup command: use_2to3 is invalid. As anyjson package is no longer maintained (last release was 2012), change the tests to use a package that is healthy. For details on the setuptools change, see the history at: https://setuptools.readthedocs.io/en/latest/history.html#v58-0-2 --- news/753e9f4f-32d3-4986-a78a-f84406ea752a.trivial.rst | 0 tests/functional/test_install_reqs.py | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 news/753e9f4f-32d3-4986-a78a-f84406ea752a.trivial.rst diff --git a/news/753e9f4f-32d3-4986-a78a-f84406ea752a.trivial.rst b/news/753e9f4f-32d3-4986-a78a-f84406ea752a.trivial.rst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py index 914524630ac..b8f8925ce30 100644 --- a/tests/functional/test_install_reqs.py +++ b/tests/functional/test_install_reqs.py @@ -62,7 +62,7 @@ def test_requirements_file(script, with_wheel): Test installing from a requirements file. """ - other_lib_name, other_lib_version = "anyjson", "0.3" + other_lib_name, other_lib_version = "peppercorn", "0.6" script.scratch_path.joinpath("initools-req.txt").write_text( textwrap.dedent( f"""\ @@ -157,7 +157,7 @@ def test_multiple_requirements_files(script, tmpdir, with_wheel): Test installing from multiple nested requirements files. """ - other_lib_name, other_lib_version = "anyjson", "0.3" + other_lib_name, other_lib_version = "six", "1.16.0" script.scratch_path.joinpath("initools-req.txt").write_text( textwrap.dedent( """ From a4f483e96f5a93e6dd0028c77713827bafd26642 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 9 Sep 2021 21:00:50 -0700 Subject: [PATCH 11/15] Handle TODO comment in tests/functional/test_new_resolver.py --- ...4a-49f0-4b33-8cbd-84727ececfb4.trivial.rst | 0 tests/functional/test_new_resolver.py | 157 ++++++++---------- 2 files changed, 73 insertions(+), 84 deletions(-) create mode 100644 news/19777e4a-49f0-4b33-8cbd-84727ececfb4.trivial.rst diff --git a/news/19777e4a-49f0-4b33-8cbd-84727ececfb4.trivial.rst b/news/19777e4a-49f0-4b33-8cbd-84727ececfb4.trivial.rst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/functional/test_new_resolver.py b/tests/functional/test_new_resolver.py index c07b9bba957..d0f5a3c8621 100644 --- a/tests/functional/test_new_resolver.py +++ b/tests/functional/test_new_resolver.py @@ -16,16 +16,6 @@ from tests.lib.wheel import make_wheel -# TODO: Remove me. -def assert_installed(script, **kwargs): - script.assert_installed(**kwargs) - - -# TODO: Remove me. -def assert_not_installed(script, *args): - script.assert_not_installed(*args) - - def assert_editable(script, *args): # This simply checks whether all of the listed packages have a # corresponding .egg-link file installed. @@ -67,7 +57,7 @@ def test_new_resolver_can_install(script): script.scratch_path, "simple", ) - assert_installed(script, simple="0.1.0") + script.assert_installed(simple="0.1.0") def test_new_resolver_can_install_with_version(script): @@ -84,7 +74,7 @@ def test_new_resolver_can_install_with_version(script): script.scratch_path, "simple==0.1.0", ) - assert_installed(script, simple="0.1.0") + script.assert_installed(simple="0.1.0") def test_new_resolver_picks_latest_version(script): @@ -106,7 +96,7 @@ def test_new_resolver_picks_latest_version(script): script.scratch_path, "simple", ) - assert_installed(script, simple="0.2.0") + script.assert_installed(simple="0.2.0") def test_new_resolver_picks_installed_version(script): @@ -128,7 +118,7 @@ def test_new_resolver_picks_installed_version(script): script.scratch_path, "simple==0.1.0", ) - assert_installed(script, simple="0.1.0") + script.assert_installed(simple="0.1.0") result = script.pip( "install", @@ -139,7 +129,7 @@ def test_new_resolver_picks_installed_version(script): "simple", ) assert "Collecting" not in result.stdout, "Should not fetch new version" - assert_installed(script, simple="0.1.0") + script.assert_installed(simple="0.1.0") def test_new_resolver_picks_installed_version_if_no_match_found(script): @@ -161,11 +151,11 @@ def test_new_resolver_picks_installed_version_if_no_match_found(script): script.scratch_path, "simple==0.1.0", ) - assert_installed(script, simple="0.1.0") + script.assert_installed(simple="0.1.0") result = script.pip("install", "--no-cache-dir", "--no-index", "simple") assert "Collecting" not in result.stdout, "Should not fetch new version" - assert_installed(script, simple="0.1.0") + script.assert_installed(simple="0.1.0") def test_new_resolver_installs_dependencies(script): @@ -188,7 +178,7 @@ def test_new_resolver_installs_dependencies(script): script.scratch_path, "base", ) - assert_installed(script, base="0.1.0", dep="0.1.0") + script.assert_installed(base="0.1.0", dep="0.1.0") def test_new_resolver_ignore_dependencies(script): @@ -212,8 +202,8 @@ def test_new_resolver_ignore_dependencies(script): script.scratch_path, "base", ) - assert_installed(script, base="0.1.0") - assert_not_installed(script, "dep") + script.assert_installed(base="0.1.0") + script.assert_not_installed("dep") @pytest.mark.parametrize( @@ -247,7 +237,7 @@ def test_new_resolver_installs_extras(tmpdir, script, root_dep): "-r", req_file, ) - assert_installed(script, base="0.1.0", dep="0.1.0") + script.assert_installed(base="0.1.0", dep="0.1.0") def test_new_resolver_installs_extras_warn_missing(script): @@ -273,7 +263,7 @@ def test_new_resolver_installs_extras_warn_missing(script): ) assert "does not provide the extra" in result.stderr, str(result) assert "missing" in result.stderr, str(result) - assert_installed(script, base="0.1.0", dep="0.1.0") + script.assert_installed(base="0.1.0", dep="0.1.0") def test_new_resolver_installed_message(script): @@ -336,7 +326,7 @@ def test_new_resolver_installs_editable(script): "--editable", source_dir, ) - assert_installed(script, base="0.1.0", dep="0.1.0") + script.assert_installed(base="0.1.0", dep="0.1.0") assert_editable(script, "dep") @@ -388,7 +378,7 @@ def test_new_resolver_requires_python( script.pip(*args) - assert_installed(script, base="0.1.0", dep=dep_version) + script.assert_installed(base="0.1.0", dep=dep_version) def test_new_resolver_requires_python_error(script): @@ -513,7 +503,7 @@ def test_new_resolver_only_builds_sdists_when_needed(script): script.scratch_path, "base", ) - assert_installed(script, base="0.1.0", dep="0.2.0") + script.assert_installed(base="0.1.0", dep="0.2.0") # We merge criteria here, as we have two "dep" requirements script.pip( @@ -525,7 +515,7 @@ def test_new_resolver_only_builds_sdists_when_needed(script): "base", "dep", ) - assert_installed(script, base="0.1.0", dep="0.2.0") + script.assert_installed(base="0.1.0", dep="0.2.0") def test_new_resolver_install_different_version(script): @@ -554,7 +544,7 @@ def test_new_resolver_install_different_version(script): assert "Uninstalling base-0.1.0" in result.stdout, str(result) assert "Successfully uninstalled base-0.1.0" in result.stdout, str(result) result.did_update(script.site_packages / "base", message="base not upgraded") - assert_installed(script, base="0.2.0") + script.assert_installed(base="0.2.0") def test_new_resolver_force_reinstall(script): @@ -584,7 +574,7 @@ def test_new_resolver_force_reinstall(script): assert "Uninstalling base-0.1.0" in result.stdout, str(result) assert "Successfully uninstalled base-0.1.0" in result.stdout, str(result) result.did_update(script.site_packages / "base", message="base not reinstalled") - assert_installed(script, base="0.1.0") + script.assert_installed(base="0.1.0") @pytest.mark.parametrize( @@ -617,7 +607,7 @@ def test_new_resolver_handles_prerelease( script.scratch_path, *pip_args, ) - assert_installed(script, pkg=expected_version) + script.assert_installed(pkg=expected_version) @pytest.mark.parametrize( @@ -641,8 +631,8 @@ def test_new_reolver_skips_marker(script, pkg_deps, root_deps): script.scratch_path, *root_deps, ) - assert_installed(script, pkg="1.0") - assert_not_installed(script, "dep") + script.assert_installed(pkg="1.0") + script.assert_not_installed("dep") @pytest.mark.parametrize( @@ -670,8 +660,8 @@ def test_new_resolver_constraints(script, constraints): constraints_file, "pkg", ) - assert_installed(script, pkg="1.0") - assert_not_installed(script, "constraint_only") + script.assert_installed(pkg="1.0") + script.assert_not_installed("constraint_only") def test_new_resolver_constraint_no_specifier(script): @@ -689,7 +679,7 @@ def test_new_resolver_constraint_no_specifier(script): constraints_file, "pkg", ) - assert_installed(script, pkg="1.0") + script.assert_installed(pkg="1.0") @pytest.mark.parametrize( @@ -745,8 +735,8 @@ def test_new_resolver_constraint_on_dependency(script): constraints_file, "base", ) - assert_installed(script, base="1.0") - assert_installed(script, dep="2.0") + script.assert_installed(base="1.0") + script.assert_installed(dep="2.0") @pytest.mark.parametrize( @@ -810,7 +800,7 @@ def test_new_resolver_constraint_only_marker_match(script): script.scratch_path, "pkg", ) - assert_installed(script, pkg="1.0") + script.assert_installed(pkg="1.0") def test_new_resolver_upgrade_needs_option(script): @@ -839,7 +829,7 @@ def test_new_resolver_upgrade_needs_option(script): ) assert "Requirement already satisfied" in result.stdout, str(result) - assert_installed(script, pkg="1.0.0") + script.assert_installed(pkg="1.0.0") # This should upgrade result = script.pip( @@ -855,7 +845,7 @@ def test_new_resolver_upgrade_needs_option(script): assert "Uninstalling pkg-1.0.0" in result.stdout, str(result) assert "Successfully uninstalled pkg-1.0.0" in result.stdout, str(result) result.did_update(script.site_packages / "pkg", message="pkg not upgraded") - assert_installed(script, pkg="2.0.0") + script.assert_installed(pkg="2.0.0") def test_new_resolver_upgrade_strategy(script): @@ -870,8 +860,8 @@ def test_new_resolver_upgrade_strategy(script): "base", ) - assert_installed(script, base="1.0.0") - assert_installed(script, dep="1.0.0") + script.assert_installed(base="1.0.0") + script.assert_installed(dep="1.0.0") # Now release new versions create_basic_wheel_for_package(script, "base", "2.0.0", depends=["dep"]) @@ -889,8 +879,8 @@ def test_new_resolver_upgrade_strategy(script): # With upgrade strategy "only-if-needed" (the default), dep should not # be upgraded. - assert_installed(script, base="2.0.0") - assert_installed(script, dep="1.0.0") + script.assert_installed(base="2.0.0") + script.assert_installed(dep="1.0.0") create_basic_wheel_for_package(script, "base", "3.0.0", depends=["dep"]) script.pip( @@ -905,8 +895,8 @@ def test_new_resolver_upgrade_strategy(script): ) # With upgrade strategy "eager", dep should be upgraded. - assert_installed(script, base="3.0.0") - assert_installed(script, dep="2.0.0") + script.assert_installed(base="3.0.0") + script.assert_installed(dep="2.0.0") class TestExtraMerge: @@ -983,7 +973,7 @@ def test_new_resolver_extra_merge_in_package( script.scratch_path, requirement + "[dev]", ) - assert_installed(script, pkg="1.0.0", dep="1.0.0", depdev="1.0.0") + script.assert_installed(pkg="1.0.0", dep="1.0.0", depdev="1.0.0") def test_new_resolver_build_directory_error_zazo_19(script): @@ -1028,7 +1018,7 @@ def test_new_resolver_build_directory_error_zazo_19(script): "pkg-a", "pkg-b", ) - assert_installed(script, pkg_a="3.0.0", pkg_b="1.0.0") + script.assert_installed(pkg_a="3.0.0", pkg_b="1.0.0") def test_new_resolver_upgrade_same_version(script): @@ -1043,7 +1033,7 @@ def test_new_resolver_upgrade_same_version(script): script.scratch_path, "pkg", ) - assert_installed(script, pkg="2") + script.assert_installed(pkg="2") script.pip( "install", @@ -1054,7 +1044,7 @@ def test_new_resolver_upgrade_same_version(script): "--upgrade", "pkg", ) - assert_installed(script, pkg="2") + script.assert_installed(pkg="2") def test_new_resolver_local_and_req(script): @@ -1127,7 +1117,7 @@ def test_new_resolver_prefers_installed_in_upgrade_if_latest(script): "--upgrade", "pkg", ) - assert_installed(script, pkg="2") + script.assert_installed(pkg="2") @pytest.mark.parametrize("N", [2, 10, 20]) @@ -1168,7 +1158,7 @@ def test_new_resolver_presents_messages_when_backtracking_a_lot(script, N): "A", ) - assert_installed(script, A="1.0.0", B="1.0.0", C="1.0.0") + script.assert_installed(A="1.0.0", B="1.0.0", C="1.0.0") # These numbers are hard-coded in the code. if N >= 1: assert "This could take a while." in result.stdout @@ -1218,7 +1208,7 @@ def test_new_resolver_check_wheel_version_normalized( script.scratch_path, "simple", ) - assert_installed(script, simple="0.1.0+local.1") + script.assert_installed(simple="0.1.0+local.1") def test_new_resolver_does_reinstall_local_sdists(script): @@ -1233,7 +1223,7 @@ def test_new_resolver_does_reinstall_local_sdists(script): "--no-index", archive_path, ) - assert_installed(script, pkg="1.0") + script.assert_installed(pkg="1.0") result = script.pip( "install", @@ -1244,7 +1234,7 @@ def test_new_resolver_does_reinstall_local_sdists(script): ) assert "Installing collected packages: pkg" in result.stdout, str(result) assert "DEPRECATION" in result.stderr, str(result) - assert_installed(script, pkg="1.0") + script.assert_installed(pkg="1.0") def test_new_resolver_does_reinstall_local_paths(script): @@ -1255,7 +1245,7 @@ def test_new_resolver_does_reinstall_local_paths(script): "--no-index", pkg, ) - assert_installed(script, pkg="1.0") + script.assert_installed(pkg="1.0") result = script.pip( "install", @@ -1264,7 +1254,7 @@ def test_new_resolver_does_reinstall_local_paths(script): pkg, ) assert "Installing collected packages: pkg" in result.stdout, str(result) - assert_installed(script, pkg="1.0") + script.assert_installed(pkg="1.0") def test_new_resolver_does_not_reinstall_when_from_a_local_index(script): @@ -1281,7 +1271,7 @@ def test_new_resolver_does_not_reinstall_when_from_a_local_index(script): script.scratch_path, "simple", ) - assert_installed(script, simple="0.1.0") + script.assert_installed(simple="0.1.0") result = script.pip( "install", @@ -1294,7 +1284,7 @@ def test_new_resolver_does_not_reinstall_when_from_a_local_index(script): # Should not reinstall! assert "Installing collected packages: simple" not in result.stdout, str(result) assert "Requirement already satisfied: simple" in result.stdout, str(result) - assert_installed(script, simple="0.1.0") + script.assert_installed(simple="0.1.0") def test_new_resolver_skip_inconsistent_metadata(script): @@ -1317,7 +1307,7 @@ def test_new_resolver_skip_inconsistent_metadata(script): assert ( " inconsistent version: filename has '3', but metadata has '2'" ) in result.stderr, str(result) - assert_installed(script, a="1") + script.assert_installed(a="1") @pytest.mark.parametrize( @@ -1357,9 +1347,9 @@ def test_new_resolver_lazy_fetch_candidates(script, upgrade): # pip should install the version preferred by the strategy... if upgrade: - assert_installed(script, myuberpkg="3") + script.assert_installed(myuberpkg="3") else: - assert_installed(script, myuberpkg="1") + script.assert_installed(myuberpkg="1") # But should reach there in the best route possible, without trying # candidates it does not need to. @@ -1424,8 +1414,8 @@ def test_new_resolver_does_not_install_unneeded_packages_with_url_constraint(scr "installed", ) - assert_installed(script, installed="0.1.0") - assert_not_installed(script, "not_installed") + script.assert_installed(installed="0.1.0") + script.assert_not_installed("not_installed") def test_new_resolver_installs_packages_with_url_constraint(script): @@ -1442,7 +1432,7 @@ def test_new_resolver_installs_packages_with_url_constraint(script): "install", "--no-cache-dir", "--no-index", "-c", constraints_file, "installed" ) - assert_installed(script, installed="0.1.0") + script.assert_installed(installed="0.1.0") def test_new_resolver_reinstall_link_requirement_with_constraint(script): @@ -1475,7 +1465,7 @@ def test_new_resolver_reinstall_link_requirement_with_constraint(script): # TODO: strengthen assertion to "second invocation does no work" # I don't think this is true yet, but it should be in the future. - assert_installed(script, installed="0.1.0") + script.assert_installed(installed="0.1.0") def test_new_resolver_prefers_url_constraint(script): @@ -1507,7 +1497,7 @@ def test_new_resolver_prefers_url_constraint(script): "test_pkg", ) - assert_installed(script, test_pkg="0.1.0") + script.assert_installed(test_pkg="0.1.0") def test_new_resolver_prefers_url_constraint_on_update(script): @@ -1537,7 +1527,7 @@ def test_new_resolver_prefers_url_constraint_on_update(script): "test_pkg", ) - assert_installed(script, test_pkg="0.2.0") + script.assert_installed(test_pkg="0.2.0") script.pip( "install", @@ -1550,7 +1540,7 @@ def test_new_resolver_prefers_url_constraint_on_update(script): "test_pkg", ) - assert_installed(script, test_pkg="0.1.0") + script.assert_installed(test_pkg="0.1.0") @pytest.mark.parametrize("version_option", ["--constraint", "--requirement"]) @@ -1594,7 +1584,7 @@ def test_new_resolver_fails_with_url_constraint_and_incompatible_version( "because these package versions have conflicting dependencies." ) in result.stderr, str(result) - assert_not_installed(script, "test_pkg") + script.assert_not_installed("test_pkg") # Assert that pip works properly in the absence of the constraints file. script.pip( @@ -1645,8 +1635,8 @@ def test_new_resolver_ignores_unneeded_conflicting_constraints(script): "installed", ) - assert_not_installed(script, "test_pkg") - assert_installed(script, installed="0.1.0") + script.assert_not_installed("test_pkg") + script.assert_installed(installed="0.1.0") def test_new_resolver_fails_on_needed_conflicting_constraints(script): @@ -1686,7 +1676,7 @@ def test_new_resolver_fails_on_needed_conflicting_constraints(script): "dependencies." ) in result.stderr, str(result) - assert_not_installed(script, "test_pkg") + script.assert_not_installed("test_pkg") # Assert that pip works properly in the absence of the constraints file. script.pip( @@ -1731,7 +1721,7 @@ def test_new_resolver_fails_on_conflicting_constraint_and_requirement(script): "because these package versions have conflicting dependencies." ) in result.stderr, str(result) - assert_not_installed(script, "test_pkg") + script.assert_not_installed("test_pkg") # Assert that pip works properly in the absence of the constraints file. script.pip( @@ -1776,7 +1766,7 @@ def test_new_resolver_succeeds_on_matching_constraint_and_requirement(script, ed *last_args, ) - assert_installed(script, test_pkg="0.1.0") + script.assert_installed(test_pkg="0.1.0") if editable: assert_editable(script, "test-pkg") @@ -1813,7 +1803,7 @@ def test_new_resolver_applies_url_constraint_to_dep(script): "base", ) - assert_installed(script, dep="0.1.0") + script.assert_installed(dep="0.1.0") def test_new_resolver_handles_compatible_wheel_tags_in_constraint_url( @@ -1885,7 +1875,7 @@ def test_new_resolver_handles_incompatible_wheel_tags_in_constraint_url( "dependencies." ) in result.stderr, str(result) - assert_not_installed(script, "base") + script.assert_not_installed("base") def test_new_resolver_avoids_incompatible_wheel_tags_in_constraint_url( @@ -1926,8 +1916,8 @@ def test_new_resolver_avoids_incompatible_wheel_tags_in_constraint_url( "base", ) - assert_installed(script, base="0.1.0") - assert_not_installed(script, "dep") + script.assert_installed(base="0.1.0") + script.assert_not_installed("dep") @pytest.mark.parametrize( @@ -2018,9 +2008,9 @@ def test_new_resolver_direct_url_equivalent( ) if suffixes_equivalent: - assert_installed(script, pkga="1", pkgb="1") + script.assert_installed(pkga="1", pkgb="1") else: - assert_not_installed(script, "pkga", "pkgb") + script.assert_not_installed("pkga", "pkgb") def test_new_resolver_direct_url_with_extras(tmp_path, script): @@ -2058,7 +2048,7 @@ def test_new_resolver_direct_url_with_extras(tmp_path, script): "pkg3", ) - assert_installed(script, pkg1="1", pkg2="1", pkg3="1") + script.assert_installed(pkg1="1", pkg2="1", pkg3="1") assert not get_created_direct_url(result, "pkg1") assert get_created_direct_url(result, "pkg2") assert not get_created_direct_url(result, "pkg3") @@ -2095,7 +2085,7 @@ def test_new_resolver_modifies_installed_incompatible(script): script.scratch_path, "d==1", ) - assert_installed(script, d="1", c="2", b="2", a="2") + script.assert_installed(d="1", c="2", b="2", a="2") def test_new_resolver_transitively_depends_on_unnamed_local(script): @@ -2122,8 +2112,7 @@ def test_new_resolver_transitively_depends_on_unnamed_local(script): f"{certbot}[docs]", certbot_apache, ) - assert_installed( - script, + script.assert_installed( certbot="99.99.0.dev0", certbot_apache="99.99.0.dev0", certbot_docs="1", From 5c6169465ec96fb8a08a41cc9edc6e5b93825e14 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Tue, 7 Sep 2021 19:59:19 -0700 Subject: [PATCH 12/15] Remove unused class TestUpgradeDistributeToSetuptools Unused since 6b5414578371ed6816964cb2a82a4cf6fd5552ed when the last test method was removed. Removing the class avoids the need to add type annotations. --- ...79-edeb-4ad2-ad20-1237de12968d.trivial.rst | 0 tests/functional/test_install_upgrade.py | 49 ------------------- 2 files changed, 49 deletions(-) create mode 100644 news/b27bb979-edeb-4ad2-ad20-1237de12968d.trivial.rst diff --git a/news/b27bb979-edeb-4ad2-ad20-1237de12968d.trivial.rst b/news/b27bb979-edeb-4ad2-ad20-1237de12968d.trivial.rst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/functional/test_install_upgrade.py b/tests/functional/test_install_upgrade.py index f81dc14a784..edeebb0b9b4 100644 --- a/tests/functional/test_install_upgrade.py +++ b/tests/functional/test_install_upgrade.py @@ -1,6 +1,5 @@ import itertools import os -import sys import textwrap import pytest @@ -352,54 +351,6 @@ def test_upgrade_vcs_req_with_dist_found(script): assert "pypi.org" not in result.stdout, result.stdout -class TestUpgradeDistributeToSetuptools: - """ - From pip1.4 to pip6, pip supported a set of "hacks" (see Issue #1122) to - allow distribute to conflict with setuptools, so that the following would - work to upgrade distribute: - - ``pip install -U setuptools`` - - In pip7, the hacks were removed. This test remains to at least confirm pip - can upgrade distribute to setuptools using: - - ``pip install -U distribute`` - - The reason this works is that a final version of distribute (v0.7.3) was - released that is simple wrapper with: - - install_requires=['setuptools>=0.7'] - - The test use a fixed set of packages from our test packages dir. Note that - virtualenv-1.9.1 contains distribute-0.6.34 and virtualenv-1.10 contains - setuptools-0.9.7 - """ - - def prep_ve(self, script, version, pip_src, distribute=False): - self.script = script - self.script.pip_install_local(f"virtualenv=={version}") - args = ["virtualenv", self.script.scratch_path / "VE"] - if distribute: - args.insert(1, "--distribute") - if version == "1.9.1" and not distribute: - # setuptools 0.6 didn't support PYTHONDONTWRITEBYTECODE - del self.script.environ["PYTHONDONTWRITEBYTECODE"] - self.script.run(*args) - if sys.platform == "win32": - bindir = "Scripts" - else: - bindir = "bin" - self.ve_bin = self.script.scratch_path / "VE" / bindir - self.script.run(self.ve_bin / "pip", "uninstall", "-y", "pip") - self.script.run( - self.ve_bin / "python", - "setup.py", - "install", - cwd=pip_src, - expect_stderr=True, - ) - - @pytest.mark.parametrize( "req1, req2", list( From 3b8113d452f41fac6a5f7b10dca9633df2dce377 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Sat, 11 Sep 2021 23:33:10 +0100 Subject: [PATCH 13/15] Bump to vendoring 1.0.x This now supports: - Clearer failure mode, for imports of the format `import x.y` - Regular expression support for dropping files (useful for when we vendor pygments) - Patching files prior to rewriting imports, allowing generation of patches on the original package sources. - Detection of py.typed files, which omits generation of unnecessary `.pyi` stubs. --- noxfile.py | 2 +- src/pip/_vendor/idna.pyi | 1 - src/pip/_vendor/packaging.pyi | 1 - src/pip/_vendor/resolvelib.pyi | 1 - src/pip/_vendor/tenacity.pyi | 1 - src/pip/_vendor/tomli.pyi | 1 - src/pip/_vendor/urllib3/contrib/pyopenssl.py | 4 +-- .../urllib3/contrib/securetransport.py | 4 +-- tools/vendoring/patches/requests.patch | 14 ++++----- tools/vendoring/patches/urllib3.patch | 29 +++++++++++++++++++ tox.ini | 2 +- 11 files changed, 42 insertions(+), 18 deletions(-) delete mode 100644 src/pip/_vendor/idna.pyi delete mode 100644 src/pip/_vendor/packaging.pyi delete mode 100644 src/pip/_vendor/resolvelib.pyi delete mode 100644 src/pip/_vendor/tenacity.pyi delete mode 100644 src/pip/_vendor/tomli.pyi create mode 100644 tools/vendoring/patches/urllib3.patch diff --git a/noxfile.py b/noxfile.py index 3cab71848d0..910e61eb51b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -171,7 +171,7 @@ def lint(session: nox.Session) -> None: @nox.session def vendoring(session: nox.Session) -> None: - session.install("vendoring>=0.3.0") + session.install("vendoring~=1.0.0") if "--upgrade" not in session.posargs: session.run("vendoring", "sync", ".", "-v") diff --git a/src/pip/_vendor/idna.pyi b/src/pip/_vendor/idna.pyi deleted file mode 100644 index 7410d72fe7d..00000000000 --- a/src/pip/_vendor/idna.pyi +++ /dev/null @@ -1 +0,0 @@ -from idna import * \ No newline at end of file diff --git a/src/pip/_vendor/packaging.pyi b/src/pip/_vendor/packaging.pyi deleted file mode 100644 index 3458a3d6374..00000000000 --- a/src/pip/_vendor/packaging.pyi +++ /dev/null @@ -1 +0,0 @@ -from packaging import * \ No newline at end of file diff --git a/src/pip/_vendor/resolvelib.pyi b/src/pip/_vendor/resolvelib.pyi deleted file mode 100644 index b4ef4e108c4..00000000000 --- a/src/pip/_vendor/resolvelib.pyi +++ /dev/null @@ -1 +0,0 @@ -from resolvelib import * \ No newline at end of file diff --git a/src/pip/_vendor/tenacity.pyi b/src/pip/_vendor/tenacity.pyi deleted file mode 100644 index baf1de9dd9f..00000000000 --- a/src/pip/_vendor/tenacity.pyi +++ /dev/null @@ -1 +0,0 @@ -from tenacity import * \ No newline at end of file diff --git a/src/pip/_vendor/tomli.pyi b/src/pip/_vendor/tomli.pyi deleted file mode 100644 index b894db6919b..00000000000 --- a/src/pip/_vendor/tomli.pyi +++ /dev/null @@ -1 +0,0 @@ -from tomli import * \ No newline at end of file diff --git a/src/pip/_vendor/urllib3/contrib/pyopenssl.py b/src/pip/_vendor/urllib3/contrib/pyopenssl.py index c43146279d3..3130f51ac06 100644 --- a/src/pip/_vendor/urllib3/contrib/pyopenssl.py +++ b/src/pip/_vendor/urllib3/contrib/pyopenssl.py @@ -28,8 +28,8 @@ .. code-block:: python try: - import urllib3.contrib.pyopenssl - urllib3.contrib.pyopenssl.inject_into_urllib3() + import pip._vendor.urllib3.contrib.pyopenssl as pyopenssl + pyopenssl.inject_into_urllib3() except ImportError: pass diff --git a/src/pip/_vendor/urllib3/contrib/securetransport.py b/src/pip/_vendor/urllib3/contrib/securetransport.py index b9755545418..b4ca80b88be 100644 --- a/src/pip/_vendor/urllib3/contrib/securetransport.py +++ b/src/pip/_vendor/urllib3/contrib/securetransport.py @@ -19,8 +19,8 @@ To use this module, simply import and inject it:: - import urllib3.contrib.securetransport - urllib3.contrib.securetransport.inject_into_urllib3() + import pip._vendor.urllib3.contrib.securetransport as securetransport + securetransport.inject_into_urllib3() Happy TLSing! diff --git a/tools/vendoring/patches/requests.patch b/tools/vendoring/patches/requests.patch index d1bb4309b37..04e6339f484 100644 --- a/tools/vendoring/patches/requests.patch +++ b/tools/vendoring/patches/requests.patch @@ -6,7 +6,7 @@ index 0f8ae0d38..9582fa730 100644 import sys -try: -- from pip._vendor import chardet +- import chardet -except ImportError: - import charset_normalizer as chardet - import warnings @@ -40,7 +40,7 @@ diff --git a/src/pip/_vendor/requests/__init__.py b/src/pip/_vendor/requests/__i index 973497f5e..4f80e28fc 100644 --- a/src/pip/_vendor/requests/__init__.py +++ b/src/pip/_vendor/requests/__init__.py -@@ -44,10 +44,7 @@ from pip._vendor import urllib3 +@@ -44,10 +44,7 @@ import urllib3 import warnings from .exceptions import RequestsDependencyWarning @@ -51,7 +51,7 @@ index 973497f5e..4f80e28fc 100644 +charset_normalizer_version = None try: - from pip._vendor.chardet import __version__ as chardet_version + from chardet import __version__ as chardet_version @@ -107,6 +104,11 @@ except (AssertionError, ValueError): # if the standard library doesn't support SNI or the # 'ssl' library isn't available. @@ -74,10 +74,10 @@ index 409b7b028..9e2937167 100644 """ -try: -- from pip._vendor import chardet +- import chardet -except ImportError: - import charset_normalizer as chardet -+from pip._vendor import chardet ++import chardet import sys @@ -105,7 +105,7 @@ diff --git a/src/pip/_vendor/requests/help.py b/src/pip/_vendor/requests/help.py index 3a843404c..745f0d7b3 100644 --- a/src/pip/_vendor/requests/help.py +++ b/src/pip/_vendor/requests/help.py -@@ -11,10 +11,7 @@ from pip._vendor import urllib3 +@@ -11,10 +11,7 @@ import urllib3 from . import __version__ as requests_version @@ -116,4 +116,4 @@ index 3a843404c..745f0d7b3 100644 +charset_normalizer = None try: - from pip._vendor import chardet + import chardet diff --git a/tools/vendoring/patches/urllib3.patch b/tools/vendoring/patches/urllib3.patch new file mode 100644 index 00000000000..3ca7226fa6d --- /dev/null +++ b/tools/vendoring/patches/urllib3.patch @@ -0,0 +1,29 @@ +diff --git a/src/pip/_vendor/urllib3/contrib/securetransport.py b/src/pip/_vendor/urllib3/contrib/securetransport.py +index b97555454..189132baa 100644 +--- a/src/pip/_vendor/urllib3/contrib/securetransport.py ++++ b/src/pip/_vendor/urllib3/contrib/securetransport.py +@@ -19,8 +19,8 @@ + + To use this module, simply import and inject it:: + +- import urllib3.contrib.securetransport +- urllib3.contrib.securetransport.inject_into_urllib3() ++ import urllib3.contrib.securetransport as securetransport ++ securetransport.inject_into_urllib3() + + Happy TLSing! + +diff --git a/src/pip/_vendor/urllib3/contrib/pyopenssl.py b/src/pip/_vendor/urllib3/contrib/pyopenssl.py +index c43146279..4cded53f6 100644 +--- a/src/pip/_vendor/urllib3/contrib/pyopenssl.py ++++ b/src/pip/_vendor/urllib3/contrib/pyopenssl.py +@@ -28,7 +28,7 @@ + .. code-block:: python + + try: +- import urllib3.contrib.pyopenssl +- urllib3.contrib.pyopenssl.inject_into_urllib3() ++ import urllib3.contrib.pyopenssl as pyopenssl ++ pyopenssl.inject_into_urllib3() + except ImportError: + pass diff --git a/tox.ini b/tox.ini index a46ad04b7b3..23738ad1ae5 100644 --- a/tox.ini +++ b/tox.ini @@ -70,7 +70,7 @@ basepython = python3 skip_install = True commands_pre = deps = - vendoring~=0.3.3 + vendoring~=1.0.0 # Required, otherwise we interpret --no-binary :all: as # "do not build wheels", which fails for PEP 517 requirements pip>=19.3.1 From 58f1cda0450344fee0ee09d88f20e1171069946f Mon Sep 17 00:00:00 2001 From: Damian Shaw Date: Sat, 4 Sep 2021 19:45:19 -0400 Subject: [PATCH 14/15] Fix known depths --- src/pip/_internal/resolution/resolvelib/provider.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pip/_internal/resolution/resolvelib/provider.py b/src/pip/_internal/resolution/resolvelib/provider.py index 632854d3bc5..a3250b35161 100644 --- a/src/pip/_internal/resolution/resolvelib/provider.py +++ b/src/pip/_internal/resolution/resolvelib/provider.py @@ -112,9 +112,9 @@ def get_preference( for _, parent in information[identifier] ) inferred_depth = min(d for d in parent_depths) + 1.0 - self._known_depths[identifier] = inferred_depth else: inferred_depth = 1.0 + self._known_depths[identifier] = inferred_depth requested_order = self._user_requested.get(identifier, math.inf) From e37ad39205443b0906971ee377dfa0d0179749ea Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Mon, 13 Sep 2021 18:37:33 -0700 Subject: [PATCH 15/15] Simplify vendoring configuration The msgpack-python was replaced by msgpack. This removes the need to special case its directory. The pytoml library is no longer vendored. The resolvelib package distributes its license and so doesn't require a license fallback URL. --- news/b27c8011-c478-4a7e-adb7-6d08c4f0ba41.trivial.rst | 0 pyproject.toml | 3 --- 2 files changed, 3 deletions(-) create mode 100644 news/b27c8011-c478-4a7e-adb7-6d08c4f0ba41.trivial.rst diff --git a/news/b27c8011-c478-4a7e-adb7-6d08c4f0ba41.trivial.rst b/news/b27c8011-c478-4a7e-adb7-6d08c4f0ba41.trivial.rst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/pyproject.toml b/pyproject.toml index fbebfd081d8..a479b968d6d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,9 +53,6 @@ distro = [] [tool.vendoring.license.directories] setuptools = "pkg_resources" -msgpack-python = "msgpack" [tool.vendoring.license.fallback-urls] -pytoml = "https://github.com/avakar/pytoml/raw/master/LICENSE" -resolvelib = "https://github.com/sarugaku/resolvelib/raw/master/LICENSE" webencodings = "https://github.com/SimonSapin/python-webencodings/raw/master/LICENSE"