pip 25.1.1__py3-none-any.whl → 25.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pip/__init__.py +3 -3
- pip/_internal/__init__.py +2 -2
- pip/_internal/build_env.py +118 -94
- pip/_internal/cache.py +16 -14
- pip/_internal/cli/autocompletion.py +13 -4
- pip/_internal/cli/base_command.py +18 -7
- pip/_internal/cli/cmdoptions.py +14 -9
- pip/_internal/cli/command_context.py +4 -3
- pip/_internal/cli/index_command.py +11 -9
- pip/_internal/cli/main.py +3 -2
- pip/_internal/cli/main_parser.py +4 -3
- pip/_internal/cli/parser.py +26 -22
- pip/_internal/cli/progress_bars.py +19 -12
- pip/_internal/cli/req_command.py +16 -12
- pip/_internal/cli/spinners.py +81 -5
- pip/_internal/commands/__init__.py +5 -3
- pip/_internal/commands/cache.py +18 -15
- pip/_internal/commands/check.py +1 -2
- pip/_internal/commands/completion.py +1 -2
- pip/_internal/commands/configuration.py +26 -18
- pip/_internal/commands/debug.py +8 -6
- pip/_internal/commands/download.py +2 -3
- pip/_internal/commands/freeze.py +2 -3
- pip/_internal/commands/hash.py +1 -2
- pip/_internal/commands/help.py +1 -2
- pip/_internal/commands/index.py +15 -9
- pip/_internal/commands/inspect.py +4 -4
- pip/_internal/commands/install.py +44 -39
- pip/_internal/commands/list.py +35 -26
- pip/_internal/commands/lock.py +1 -2
- pip/_internal/commands/search.py +14 -12
- pip/_internal/commands/show.py +14 -11
- pip/_internal/commands/uninstall.py +1 -2
- pip/_internal/commands/wheel.py +2 -3
- pip/_internal/configuration.py +39 -25
- pip/_internal/distributions/base.py +6 -4
- pip/_internal/distributions/installed.py +8 -4
- pip/_internal/distributions/sdist.py +20 -13
- pip/_internal/distributions/wheel.py +6 -4
- pip/_internal/exceptions.py +58 -39
- pip/_internal/index/collector.py +24 -29
- pip/_internal/index/package_finder.py +70 -61
- pip/_internal/index/sources.py +17 -14
- pip/_internal/locations/__init__.py +18 -16
- pip/_internal/locations/_distutils.py +12 -11
- pip/_internal/locations/_sysconfig.py +5 -4
- pip/_internal/locations/base.py +4 -3
- pip/_internal/main.py +2 -2
- pip/_internal/metadata/__init__.py +8 -6
- pip/_internal/metadata/_json.py +5 -4
- pip/_internal/metadata/base.py +22 -27
- pip/_internal/metadata/importlib/_compat.py +6 -4
- pip/_internal/metadata/importlib/_dists.py +12 -17
- pip/_internal/metadata/importlib/_envs.py +9 -6
- pip/_internal/metadata/pkg_resources.py +11 -14
- pip/_internal/models/direct_url.py +24 -21
- pip/_internal/models/format_control.py +5 -5
- pip/_internal/models/installation_report.py +4 -3
- pip/_internal/models/link.py +39 -34
- pip/_internal/models/pylock.py +27 -22
- pip/_internal/models/search_scope.py +6 -7
- pip/_internal/models/selection_prefs.py +3 -3
- pip/_internal/models/target_python.py +10 -9
- pip/_internal/models/wheel.py +7 -5
- pip/_internal/network/auth.py +20 -22
- pip/_internal/network/cache.py +22 -6
- pip/_internal/network/download.py +169 -141
- pip/_internal/network/lazy_wheel.py +10 -7
- pip/_internal/network/session.py +32 -27
- pip/_internal/network/utils.py +2 -2
- pip/_internal/network/xmlrpc.py +2 -2
- pip/_internal/operations/build/build_tracker.py +10 -8
- pip/_internal/operations/build/wheel.py +3 -2
- pip/_internal/operations/build/wheel_editable.py +3 -2
- pip/_internal/operations/build/wheel_legacy.py +9 -8
- pip/_internal/operations/check.py +21 -26
- pip/_internal/operations/freeze.py +12 -9
- pip/_internal/operations/install/editable_legacy.py +5 -3
- pip/_internal/operations/install/wheel.py +49 -41
- pip/_internal/operations/prepare.py +35 -30
- pip/_internal/pyproject.py +7 -10
- pip/_internal/req/__init__.py +12 -10
- pip/_internal/req/constructors.py +33 -31
- pip/_internal/req/req_dependency_group.py +7 -11
- pip/_internal/req/req_file.py +32 -35
- pip/_internal/req/req_install.py +37 -34
- pip/_internal/req/req_set.py +4 -5
- pip/_internal/req/req_uninstall.py +20 -17
- pip/_internal/resolution/base.py +3 -3
- pip/_internal/resolution/legacy/resolver.py +21 -20
- pip/_internal/resolution/resolvelib/base.py +16 -13
- pip/_internal/resolution/resolvelib/candidates.py +29 -26
- pip/_internal/resolution/resolvelib/factory.py +41 -50
- pip/_internal/resolution/resolvelib/found_candidates.py +11 -9
- pip/_internal/resolution/resolvelib/provider.py +15 -20
- pip/_internal/resolution/resolvelib/reporter.py +5 -3
- pip/_internal/resolution/resolvelib/requirements.py +8 -6
- pip/_internal/resolution/resolvelib/resolver.py +39 -23
- pip/_internal/self_outdated_check.py +8 -6
- pip/_internal/utils/appdirs.py +1 -2
- pip/_internal/utils/compat.py +7 -1
- pip/_internal/utils/compatibility_tags.py +17 -16
- pip/_internal/utils/deprecation.py +11 -9
- pip/_internal/utils/direct_url_helpers.py +2 -2
- pip/_internal/utils/egg_link.py +6 -5
- pip/_internal/utils/entrypoints.py +3 -2
- pip/_internal/utils/filesystem.py +8 -5
- pip/_internal/utils/filetypes.py +4 -6
- pip/_internal/utils/glibc.py +6 -5
- pip/_internal/utils/hashes.py +9 -6
- pip/_internal/utils/logging.py +8 -5
- pip/_internal/utils/misc.py +37 -45
- pip/_internal/utils/packaging.py +3 -2
- pip/_internal/utils/retry.py +7 -4
- pip/_internal/utils/setuptools_build.py +12 -10
- pip/_internal/utils/subprocess.py +20 -17
- pip/_internal/utils/temp_dir.py +10 -12
- pip/_internal/utils/unpacking.py +6 -4
- pip/_internal/utils/urls.py +1 -1
- pip/_internal/utils/virtualenv.py +3 -2
- pip/_internal/utils/wheel.py +3 -4
- pip/_internal/vcs/bazaar.py +26 -8
- pip/_internal/vcs/git.py +59 -24
- pip/_internal/vcs/mercurial.py +34 -11
- pip/_internal/vcs/subversion.py +27 -16
- pip/_internal/vcs/versioncontrol.py +56 -51
- pip/_internal/wheel_builder.py +14 -12
- pip/_vendor/cachecontrol/__init__.py +1 -1
- pip/_vendor/certifi/__init__.py +1 -1
- pip/_vendor/certifi/cacert.pem +102 -221
- pip/_vendor/certifi/core.py +1 -32
- pip/_vendor/distlib/__init__.py +2 -2
- pip/_vendor/distlib/scripts.py +1 -1
- pip/_vendor/msgpack/__init__.py +2 -2
- pip/_vendor/pkg_resources/__init__.py +1 -1
- pip/_vendor/platformdirs/version.py +2 -2
- pip/_vendor/pygments/__init__.py +1 -1
- pip/_vendor/requests/__version__.py +2 -2
- pip/_vendor/requests/compat.py +12 -0
- pip/_vendor/requests/models.py +3 -1
- pip/_vendor/requests/utils.py +6 -16
- pip/_vendor/resolvelib/__init__.py +3 -3
- pip/_vendor/resolvelib/reporters.py +1 -1
- pip/_vendor/resolvelib/resolvers/__init__.py +4 -4
- pip/_vendor/resolvelib/resolvers/resolution.py +91 -10
- pip/_vendor/rich/__main__.py +12 -40
- pip/_vendor/rich/_inspect.py +1 -1
- pip/_vendor/rich/_ratio.py +1 -7
- pip/_vendor/rich/align.py +1 -7
- pip/_vendor/rich/box.py +1 -7
- pip/_vendor/rich/console.py +25 -20
- pip/_vendor/rich/control.py +1 -7
- pip/_vendor/rich/diagnose.py +1 -0
- pip/_vendor/rich/emoji.py +1 -6
- pip/_vendor/rich/live.py +32 -7
- pip/_vendor/rich/live_render.py +1 -7
- pip/_vendor/rich/logging.py +1 -1
- pip/_vendor/rich/panel.py +3 -4
- pip/_vendor/rich/progress.py +15 -15
- pip/_vendor/rich/spinner.py +7 -13
- pip/_vendor/rich/syntax.py +24 -5
- pip/_vendor/rich/traceback.py +32 -17
- pip/_vendor/truststore/_api.py +1 -1
- pip/_vendor/vendor.txt +9 -10
- {pip-25.1.1.dist-info → pip-25.2.dist-info}/METADATA +26 -4
- {pip-25.1.1.dist-info → pip-25.2.dist-info}/RECORD +193 -180
- {pip-25.1.1.dist-info → pip-25.2.dist-info}/WHEEL +1 -1
- {pip-25.1.1.dist-info → pip-25.2.dist-info}/licenses/AUTHORS.txt +12 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/cachecontrol/LICENSE.txt +13 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/certifi/LICENSE +20 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/dependency_groups/LICENSE.txt +9 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/distlib/LICENSE.txt +284 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/distro/LICENSE +202 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/idna/LICENSE.md +31 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/msgpack/COPYING +14 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/packaging/LICENSE +3 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/packaging/LICENSE.APACHE +177 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/packaging/LICENSE.BSD +23 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/pkg_resources/LICENSE +17 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/platformdirs/LICENSE +21 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/pygments/LICENSE +25 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/pyproject_hooks/LICENSE +21 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/requests/LICENSE +175 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/resolvelib/LICENSE +13 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/rich/LICENSE +19 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/tomli/LICENSE +21 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/tomli/LICENSE-HEADER +3 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/tomli_w/LICENSE +21 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/truststore/LICENSE +21 -0
- pip-25.2.dist-info/licenses/src/pip/_vendor/urllib3/LICENSE.txt +21 -0
- pip/_vendor/distlib/database.py +0 -1329
- pip/_vendor/distlib/index.py +0 -508
- pip/_vendor/distlib/locators.py +0 -1295
- pip/_vendor/distlib/manifest.py +0 -384
- pip/_vendor/distlib/markers.py +0 -162
- pip/_vendor/distlib/metadata.py +0 -1031
- pip/_vendor/distlib/version.py +0 -750
- pip/_vendor/distlib/wheel.py +0 -1100
- pip/_vendor/typing_extensions.py +0 -4584
- {pip-25.1.1.dist-info → pip-25.2.dist-info}/entry_points.txt +0 -0
- {pip-25.1.1.dist-info → pip-25.2.dist-info}/licenses/LICENSE.txt +0 -0
- {pip-25.1.1.dist-info → pip-25.2.dist-info}/top_level.txt +0 -0
pip/_internal/vcs/bazaar.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import logging
|
|
2
|
-
from typing import List, Optional, Tuple
|
|
3
4
|
|
|
4
5
|
from pip._internal.utils.misc import HiddenText, display_path
|
|
5
6
|
from pip._internal.utils.subprocess import make_command
|
|
@@ -30,7 +31,7 @@ class Bazaar(VersionControl):
|
|
|
30
31
|
)
|
|
31
32
|
|
|
32
33
|
@staticmethod
|
|
33
|
-
def get_base_rev_args(rev: str) ->
|
|
34
|
+
def get_base_rev_args(rev: str) -> list[str]:
|
|
34
35
|
return ["-r", rev]
|
|
35
36
|
|
|
36
37
|
def fetch_new(
|
|
@@ -54,24 +55,41 @@ class Bazaar(VersionControl):
|
|
|
54
55
|
)
|
|
55
56
|
self.run_command(cmd_args)
|
|
56
57
|
|
|
57
|
-
def switch(
|
|
58
|
+
def switch(
|
|
59
|
+
self,
|
|
60
|
+
dest: str,
|
|
61
|
+
url: HiddenText,
|
|
62
|
+
rev_options: RevOptions,
|
|
63
|
+
verbosity: int = 0,
|
|
64
|
+
) -> None:
|
|
58
65
|
self.run_command(make_command("switch", url), cwd=dest)
|
|
59
66
|
|
|
60
|
-
def update(
|
|
67
|
+
def update(
|
|
68
|
+
self,
|
|
69
|
+
dest: str,
|
|
70
|
+
url: HiddenText,
|
|
71
|
+
rev_options: RevOptions,
|
|
72
|
+
verbosity: int = 0,
|
|
73
|
+
) -> None:
|
|
74
|
+
flags = []
|
|
75
|
+
|
|
76
|
+
if verbosity <= 0:
|
|
77
|
+
flags.append("-q")
|
|
78
|
+
|
|
61
79
|
output = self.run_command(
|
|
62
80
|
make_command("info"), show_stdout=False, stdout_only=True, cwd=dest
|
|
63
81
|
)
|
|
64
82
|
if output.startswith("Standalone "):
|
|
65
83
|
# Older versions of pip used to create standalone branches.
|
|
66
84
|
# Convert the standalone branch to a checkout by calling "bzr bind".
|
|
67
|
-
cmd_args = make_command("bind",
|
|
85
|
+
cmd_args = make_command("bind", *flags, url)
|
|
68
86
|
self.run_command(cmd_args, cwd=dest)
|
|
69
87
|
|
|
70
|
-
cmd_args = make_command("update",
|
|
88
|
+
cmd_args = make_command("update", *flags, rev_options.to_args())
|
|
71
89
|
self.run_command(cmd_args, cwd=dest)
|
|
72
90
|
|
|
73
91
|
@classmethod
|
|
74
|
-
def get_url_rev_and_auth(cls, url: str) ->
|
|
92
|
+
def get_url_rev_and_auth(cls, url: str) -> tuple[str, str | None, AuthInfo]:
|
|
75
93
|
# hotfix the URL scheme after removing bzr+ from bzr+ssh:// re-add it
|
|
76
94
|
url, rev, user_pass = super().get_url_rev_and_auth(url)
|
|
77
95
|
if url.startswith("ssh://"):
|
|
@@ -104,7 +122,7 @@ class Bazaar(VersionControl):
|
|
|
104
122
|
return revision.splitlines()[-1]
|
|
105
123
|
|
|
106
124
|
@classmethod
|
|
107
|
-
def is_commit_id_equal(cls, dest: str, name:
|
|
125
|
+
def is_commit_id_equal(cls, dest: str, name: str | None) -> bool:
|
|
108
126
|
"""Always assume the versions don't match"""
|
|
109
127
|
return False
|
|
110
128
|
|
pip/_internal/vcs/git.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import logging
|
|
2
4
|
import os.path
|
|
3
5
|
import pathlib
|
|
@@ -5,7 +7,7 @@ import re
|
|
|
5
7
|
import urllib.parse
|
|
6
8
|
import urllib.request
|
|
7
9
|
from dataclasses import replace
|
|
8
|
-
from typing import Any
|
|
10
|
+
from typing import Any
|
|
9
11
|
|
|
10
12
|
from pip._internal.exceptions import BadCommand, InstallationError
|
|
11
13
|
from pip._internal.utils.misc import HiddenText, display_path, hide_url
|
|
@@ -74,7 +76,7 @@ class Git(VersionControl):
|
|
|
74
76
|
default_arg_rev = "HEAD"
|
|
75
77
|
|
|
76
78
|
@staticmethod
|
|
77
|
-
def get_base_rev_args(rev: str) ->
|
|
79
|
+
def get_base_rev_args(rev: str) -> list[str]:
|
|
78
80
|
return [rev]
|
|
79
81
|
|
|
80
82
|
@classmethod
|
|
@@ -100,7 +102,7 @@ class Git(VersionControl):
|
|
|
100
102
|
is_tag_or_branch = bool(self.get_revision_sha(dest, rev_options.rev)[0])
|
|
101
103
|
return not is_tag_or_branch
|
|
102
104
|
|
|
103
|
-
def get_git_version(self) ->
|
|
105
|
+
def get_git_version(self) -> tuple[int, ...]:
|
|
104
106
|
version = self.run_command(
|
|
105
107
|
["version"],
|
|
106
108
|
command_desc="git version",
|
|
@@ -114,7 +116,7 @@ class Git(VersionControl):
|
|
|
114
116
|
return (int(match.group(1)), int(match.group(2)))
|
|
115
117
|
|
|
116
118
|
@classmethod
|
|
117
|
-
def get_current_branch(cls, location: str) ->
|
|
119
|
+
def get_current_branch(cls, location: str) -> str | None:
|
|
118
120
|
"""
|
|
119
121
|
Return the current branch, or None if HEAD isn't at a branch
|
|
120
122
|
(e.g. detached HEAD).
|
|
@@ -139,7 +141,7 @@ class Git(VersionControl):
|
|
|
139
141
|
return None
|
|
140
142
|
|
|
141
143
|
@classmethod
|
|
142
|
-
def get_revision_sha(cls, dest: str, rev: str) ->
|
|
144
|
+
def get_revision_sha(cls, dest: str, rev: str) -> tuple[str | None, bool]:
|
|
143
145
|
"""
|
|
144
146
|
Return (sha_or_none, is_branch), where sha_or_none is a commit hash
|
|
145
147
|
if the revision names a remote branch or tag, otherwise None.
|
|
@@ -234,7 +236,7 @@ class Git(VersionControl):
|
|
|
234
236
|
# Do not show a warning for the common case of something that has
|
|
235
237
|
# the form of a Git commit hash.
|
|
236
238
|
if not looks_like_hash(rev):
|
|
237
|
-
logger.
|
|
239
|
+
logger.info(
|
|
238
240
|
"Did not find branch or tag '%s', assuming revision or ref.",
|
|
239
241
|
rev,
|
|
240
242
|
)
|
|
@@ -254,7 +256,7 @@ class Git(VersionControl):
|
|
|
254
256
|
return rev_options
|
|
255
257
|
|
|
256
258
|
@classmethod
|
|
257
|
-
def is_commit_id_equal(cls, dest: str, name:
|
|
259
|
+
def is_commit_id_equal(cls, dest: str, name: str | None) -> bool:
|
|
258
260
|
"""
|
|
259
261
|
Return whether the current commit hash equals the given name.
|
|
260
262
|
|
|
@@ -274,7 +276,7 @@ class Git(VersionControl):
|
|
|
274
276
|
rev_display = rev_options.to_display()
|
|
275
277
|
logger.info("Cloning %s%s to %s", url, rev_display, display_path(dest))
|
|
276
278
|
if verbosity <= 0:
|
|
277
|
-
flags:
|
|
279
|
+
flags: tuple[str, ...] = ("--quiet",)
|
|
278
280
|
elif verbosity == 1:
|
|
279
281
|
flags = ()
|
|
280
282
|
else:
|
|
@@ -329,31 +331,59 @@ class Git(VersionControl):
|
|
|
329
331
|
logger.info("Resolved %s to commit %s", url, rev_options.rev)
|
|
330
332
|
|
|
331
333
|
#: repo may contain submodules
|
|
332
|
-
self.update_submodules(dest)
|
|
333
|
-
|
|
334
|
-
def switch(
|
|
334
|
+
self.update_submodules(dest, verbosity=verbosity)
|
|
335
|
+
|
|
336
|
+
def switch(
|
|
337
|
+
self,
|
|
338
|
+
dest: str,
|
|
339
|
+
url: HiddenText,
|
|
340
|
+
rev_options: RevOptions,
|
|
341
|
+
verbosity: int = 0,
|
|
342
|
+
) -> None:
|
|
335
343
|
self.run_command(
|
|
336
344
|
make_command("config", "remote.origin.url", url),
|
|
337
345
|
cwd=dest,
|
|
338
346
|
)
|
|
339
|
-
|
|
347
|
+
|
|
348
|
+
extra_flags = []
|
|
349
|
+
|
|
350
|
+
if verbosity <= 0:
|
|
351
|
+
extra_flags.append("-q")
|
|
352
|
+
|
|
353
|
+
cmd_args = make_command("checkout", *extra_flags, rev_options.to_args())
|
|
340
354
|
self.run_command(cmd_args, cwd=dest)
|
|
341
355
|
|
|
342
|
-
self.update_submodules(dest)
|
|
356
|
+
self.update_submodules(dest, verbosity=verbosity)
|
|
357
|
+
|
|
358
|
+
def update(
|
|
359
|
+
self,
|
|
360
|
+
dest: str,
|
|
361
|
+
url: HiddenText,
|
|
362
|
+
rev_options: RevOptions,
|
|
363
|
+
verbosity: int = 0,
|
|
364
|
+
) -> None:
|
|
365
|
+
extra_flags = []
|
|
366
|
+
|
|
367
|
+
if verbosity <= 0:
|
|
368
|
+
extra_flags.append("-q")
|
|
343
369
|
|
|
344
|
-
def update(self, dest: str, url: HiddenText, rev_options: RevOptions) -> None:
|
|
345
370
|
# First fetch changes from the default remote
|
|
346
371
|
if self.get_git_version() >= (1, 9):
|
|
347
372
|
# fetch tags in addition to everything else
|
|
348
|
-
self.run_command(["fetch", "
|
|
373
|
+
self.run_command(["fetch", "--tags", *extra_flags], cwd=dest)
|
|
349
374
|
else:
|
|
350
|
-
self.run_command(["fetch",
|
|
375
|
+
self.run_command(["fetch", *extra_flags], cwd=dest)
|
|
351
376
|
# Then reset to wanted revision (maybe even origin/master)
|
|
352
377
|
rev_options = self.resolve_revision(dest, url, rev_options)
|
|
353
|
-
cmd_args = make_command(
|
|
378
|
+
cmd_args = make_command(
|
|
379
|
+
"reset",
|
|
380
|
+
"--hard",
|
|
381
|
+
*extra_flags,
|
|
382
|
+
rev_options.to_args(),
|
|
383
|
+
)
|
|
354
384
|
self.run_command(cmd_args, cwd=dest)
|
|
355
385
|
#: update submodules
|
|
356
|
-
self.update_submodules(dest)
|
|
386
|
+
self.update_submodules(dest, verbosity=verbosity)
|
|
357
387
|
|
|
358
388
|
@classmethod
|
|
359
389
|
def get_remote_url(cls, location: str) -> str:
|
|
@@ -433,7 +463,7 @@ class Git(VersionControl):
|
|
|
433
463
|
return True
|
|
434
464
|
|
|
435
465
|
@classmethod
|
|
436
|
-
def get_revision(cls, location: str, rev:
|
|
466
|
+
def get_revision(cls, location: str, rev: str | None = None) -> str:
|
|
437
467
|
if rev is None:
|
|
438
468
|
rev = "HEAD"
|
|
439
469
|
current_rev = cls.run_command(
|
|
@@ -445,7 +475,7 @@ class Git(VersionControl):
|
|
|
445
475
|
return current_rev.strip()
|
|
446
476
|
|
|
447
477
|
@classmethod
|
|
448
|
-
def get_subdirectory(cls, location: str) ->
|
|
478
|
+
def get_subdirectory(cls, location: str) -> str | None:
|
|
449
479
|
"""
|
|
450
480
|
Return the path to Python project root, relative to the repo root.
|
|
451
481
|
Return None if the project root is in the repo root.
|
|
@@ -463,7 +493,7 @@ class Git(VersionControl):
|
|
|
463
493
|
return find_path_to_project_root_from_repo_root(location, repo_root)
|
|
464
494
|
|
|
465
495
|
@classmethod
|
|
466
|
-
def get_url_rev_and_auth(cls, url: str) ->
|
|
496
|
+
def get_url_rev_and_auth(cls, url: str) -> tuple[str, str | None, AuthInfo]:
|
|
467
497
|
"""
|
|
468
498
|
Prefixes stub URLs like 'user@hostname:user/repo.git' with 'ssh://'.
|
|
469
499
|
That's required because although they use SSH they sometimes don't
|
|
@@ -494,16 +524,21 @@ class Git(VersionControl):
|
|
|
494
524
|
return url, rev, user_pass
|
|
495
525
|
|
|
496
526
|
@classmethod
|
|
497
|
-
def update_submodules(cls, location: str) -> None:
|
|
527
|
+
def update_submodules(cls, location: str, verbosity: int = 0) -> None:
|
|
528
|
+
argv = ["submodule", "update", "--init", "--recursive"]
|
|
529
|
+
|
|
530
|
+
if verbosity <= 0:
|
|
531
|
+
argv.append("-q")
|
|
532
|
+
|
|
498
533
|
if not os.path.exists(os.path.join(location, ".gitmodules")):
|
|
499
534
|
return
|
|
500
535
|
cls.run_command(
|
|
501
|
-
|
|
536
|
+
argv,
|
|
502
537
|
cwd=location,
|
|
503
538
|
)
|
|
504
539
|
|
|
505
540
|
@classmethod
|
|
506
|
-
def get_repository_root(cls, location: str) ->
|
|
541
|
+
def get_repository_root(cls, location: str) -> str | None:
|
|
507
542
|
loc = super().get_repository_root(location)
|
|
508
543
|
if loc:
|
|
509
544
|
return loc
|
pip/_internal/vcs/mercurial.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import configparser
|
|
2
4
|
import logging
|
|
3
5
|
import os
|
|
4
|
-
from typing import List, Optional, Tuple
|
|
5
6
|
|
|
6
7
|
from pip._internal.exceptions import BadCommand, InstallationError
|
|
7
8
|
from pip._internal.utils.misc import HiddenText, display_path
|
|
@@ -30,7 +31,7 @@ class Mercurial(VersionControl):
|
|
|
30
31
|
)
|
|
31
32
|
|
|
32
33
|
@staticmethod
|
|
33
|
-
def get_base_rev_args(rev: str) ->
|
|
34
|
+
def get_base_rev_args(rev: str) -> list[str]:
|
|
34
35
|
return [f"--rev={rev}"]
|
|
35
36
|
|
|
36
37
|
def fetch_new(
|
|
@@ -44,7 +45,7 @@ class Mercurial(VersionControl):
|
|
|
44
45
|
display_path(dest),
|
|
45
46
|
)
|
|
46
47
|
if verbosity <= 0:
|
|
47
|
-
flags:
|
|
48
|
+
flags: tuple[str, ...] = ("--quiet",)
|
|
48
49
|
elif verbosity == 1:
|
|
49
50
|
flags = ()
|
|
50
51
|
elif verbosity == 2:
|
|
@@ -57,9 +58,20 @@ class Mercurial(VersionControl):
|
|
|
57
58
|
cwd=dest,
|
|
58
59
|
)
|
|
59
60
|
|
|
60
|
-
def switch(
|
|
61
|
+
def switch(
|
|
62
|
+
self,
|
|
63
|
+
dest: str,
|
|
64
|
+
url: HiddenText,
|
|
65
|
+
rev_options: RevOptions,
|
|
66
|
+
verbosity: int = 0,
|
|
67
|
+
) -> None:
|
|
68
|
+
extra_flags = []
|
|
61
69
|
repo_config = os.path.join(dest, self.dirname, "hgrc")
|
|
62
70
|
config = configparser.RawConfigParser()
|
|
71
|
+
|
|
72
|
+
if verbosity <= 0:
|
|
73
|
+
extra_flags.append("-q")
|
|
74
|
+
|
|
63
75
|
try:
|
|
64
76
|
config.read(repo_config)
|
|
65
77
|
config.set("paths", "default", url.secret)
|
|
@@ -68,12 +80,23 @@ class Mercurial(VersionControl):
|
|
|
68
80
|
except (OSError, configparser.NoSectionError) as exc:
|
|
69
81
|
logger.warning("Could not switch Mercurial repository to %s: %s", url, exc)
|
|
70
82
|
else:
|
|
71
|
-
cmd_args = make_command("update",
|
|
83
|
+
cmd_args = make_command("update", *extra_flags, rev_options.to_args())
|
|
72
84
|
self.run_command(cmd_args, cwd=dest)
|
|
73
85
|
|
|
74
|
-
def update(
|
|
75
|
-
self
|
|
76
|
-
|
|
86
|
+
def update(
|
|
87
|
+
self,
|
|
88
|
+
dest: str,
|
|
89
|
+
url: HiddenText,
|
|
90
|
+
rev_options: RevOptions,
|
|
91
|
+
verbosity: int = 0,
|
|
92
|
+
) -> None:
|
|
93
|
+
extra_flags = []
|
|
94
|
+
|
|
95
|
+
if verbosity <= 0:
|
|
96
|
+
extra_flags.append("-q")
|
|
97
|
+
|
|
98
|
+
self.run_command(["pull", *extra_flags], cwd=dest)
|
|
99
|
+
cmd_args = make_command("update", *extra_flags, rev_options.to_args())
|
|
77
100
|
self.run_command(cmd_args, cwd=dest)
|
|
78
101
|
|
|
79
102
|
@classmethod
|
|
@@ -116,12 +139,12 @@ class Mercurial(VersionControl):
|
|
|
116
139
|
return current_rev_hash
|
|
117
140
|
|
|
118
141
|
@classmethod
|
|
119
|
-
def is_commit_id_equal(cls, dest: str, name:
|
|
142
|
+
def is_commit_id_equal(cls, dest: str, name: str | None) -> bool:
|
|
120
143
|
"""Always assume the versions don't match"""
|
|
121
144
|
return False
|
|
122
145
|
|
|
123
146
|
@classmethod
|
|
124
|
-
def get_subdirectory(cls, location: str) ->
|
|
147
|
+
def get_subdirectory(cls, location: str) -> str | None:
|
|
125
148
|
"""
|
|
126
149
|
Return the path to Python project root, relative to the repo root.
|
|
127
150
|
Return None if the project root is in the repo root.
|
|
@@ -135,7 +158,7 @@ class Mercurial(VersionControl):
|
|
|
135
158
|
return find_path_to_project_root_from_repo_root(location, repo_root)
|
|
136
159
|
|
|
137
160
|
@classmethod
|
|
138
|
-
def get_repository_root(cls, location: str) ->
|
|
161
|
+
def get_repository_root(cls, location: str) -> str | None:
|
|
139
162
|
loc = super().get_repository_root(location)
|
|
140
163
|
if loc:
|
|
141
164
|
return loc
|
pip/_internal/vcs/subversion.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
1
3
|
import logging
|
|
2
4
|
import os
|
|
3
5
|
import re
|
|
4
|
-
from typing import List, Optional, Tuple
|
|
5
6
|
|
|
6
7
|
from pip._internal.utils.misc import (
|
|
7
8
|
HiddenText,
|
|
@@ -38,7 +39,7 @@ class Subversion(VersionControl):
|
|
|
38
39
|
return True
|
|
39
40
|
|
|
40
41
|
@staticmethod
|
|
41
|
-
def get_base_rev_args(rev: str) ->
|
|
42
|
+
def get_base_rev_args(rev: str) -> list[str]:
|
|
42
43
|
return ["-r", rev]
|
|
43
44
|
|
|
44
45
|
@classmethod
|
|
@@ -73,7 +74,7 @@ class Subversion(VersionControl):
|
|
|
73
74
|
@classmethod
|
|
74
75
|
def get_netloc_and_auth(
|
|
75
76
|
cls, netloc: str, scheme: str
|
|
76
|
-
) ->
|
|
77
|
+
) -> tuple[str, tuple[str | None, str | None]]:
|
|
77
78
|
"""
|
|
78
79
|
This override allows the auth information to be passed to svn via the
|
|
79
80
|
--username and --password options instead of via the URL.
|
|
@@ -86,7 +87,7 @@ class Subversion(VersionControl):
|
|
|
86
87
|
return split_auth_from_netloc(netloc)
|
|
87
88
|
|
|
88
89
|
@classmethod
|
|
89
|
-
def get_url_rev_and_auth(cls, url: str) ->
|
|
90
|
+
def get_url_rev_and_auth(cls, url: str) -> tuple[str, str | None, AuthInfo]:
|
|
90
91
|
# hotfix the URL scheme after removing svn+ from svn+ssh:// re-add it
|
|
91
92
|
url, rev, user_pass = super().get_url_rev_and_auth(url)
|
|
92
93
|
if url.startswith("ssh://"):
|
|
@@ -94,9 +95,7 @@ class Subversion(VersionControl):
|
|
|
94
95
|
return url, rev, user_pass
|
|
95
96
|
|
|
96
97
|
@staticmethod
|
|
97
|
-
def make_rev_args(
|
|
98
|
-
username: Optional[str], password: Optional[HiddenText]
|
|
99
|
-
) -> CommandArgs:
|
|
98
|
+
def make_rev_args(username: str | None, password: HiddenText | None) -> CommandArgs:
|
|
100
99
|
extra_args: CommandArgs = []
|
|
101
100
|
if username:
|
|
102
101
|
extra_args += ["--username", username]
|
|
@@ -130,7 +129,7 @@ class Subversion(VersionControl):
|
|
|
130
129
|
return url
|
|
131
130
|
|
|
132
131
|
@classmethod
|
|
133
|
-
def _get_svn_url_rev(cls, location: str) ->
|
|
132
|
+
def _get_svn_url_rev(cls, location: str) -> tuple[str | None, int]:
|
|
134
133
|
from pip._internal.exceptions import InstallationError
|
|
135
134
|
|
|
136
135
|
entries_path = os.path.join(location, cls.dirname, "entries")
|
|
@@ -141,7 +140,7 @@ class Subversion(VersionControl):
|
|
|
141
140
|
data = ""
|
|
142
141
|
|
|
143
142
|
url = None
|
|
144
|
-
if data.startswith("8"
|
|
143
|
+
if data.startswith(("8", "9", "10")):
|
|
145
144
|
entries = list(map(str.splitlines, data.split("\n\x0c\n")))
|
|
146
145
|
del entries[0][0] # get rid of the '8'
|
|
147
146
|
url = entries[0][3]
|
|
@@ -180,11 +179,11 @@ class Subversion(VersionControl):
|
|
|
180
179
|
return url, rev
|
|
181
180
|
|
|
182
181
|
@classmethod
|
|
183
|
-
def is_commit_id_equal(cls, dest: str, name:
|
|
182
|
+
def is_commit_id_equal(cls, dest: str, name: str | None) -> bool:
|
|
184
183
|
"""Always assume the versions don't match"""
|
|
185
184
|
return False
|
|
186
185
|
|
|
187
|
-
def __init__(self, use_interactive:
|
|
186
|
+
def __init__(self, use_interactive: bool | None = None) -> None:
|
|
188
187
|
if use_interactive is None:
|
|
189
188
|
use_interactive = is_console_interactive()
|
|
190
189
|
self.use_interactive = use_interactive
|
|
@@ -194,11 +193,11 @@ class Subversion(VersionControl):
|
|
|
194
193
|
# Special value definitions:
|
|
195
194
|
# None: Not evaluated yet.
|
|
196
195
|
# Empty tuple: Could not parse version.
|
|
197
|
-
self._vcs_version:
|
|
196
|
+
self._vcs_version: tuple[int, ...] | None = None
|
|
198
197
|
|
|
199
198
|
super().__init__()
|
|
200
199
|
|
|
201
|
-
def call_vcs_version(self) ->
|
|
200
|
+
def call_vcs_version(self) -> tuple[int, ...]:
|
|
202
201
|
"""Query the version of the currently installed Subversion client.
|
|
203
202
|
|
|
204
203
|
:return: A tuple containing the parts of the version information or
|
|
@@ -226,7 +225,7 @@ class Subversion(VersionControl):
|
|
|
226
225
|
|
|
227
226
|
return parsed_version
|
|
228
227
|
|
|
229
|
-
def get_vcs_version(self) ->
|
|
228
|
+
def get_vcs_version(self) -> tuple[int, ...]:
|
|
230
229
|
"""Return the version of the currently installed Subversion client.
|
|
231
230
|
|
|
232
231
|
If the version of the Subversion client has already been queried,
|
|
@@ -301,7 +300,13 @@ class Subversion(VersionControl):
|
|
|
301
300
|
)
|
|
302
301
|
self.run_command(cmd_args)
|
|
303
302
|
|
|
304
|
-
def switch(
|
|
303
|
+
def switch(
|
|
304
|
+
self,
|
|
305
|
+
dest: str,
|
|
306
|
+
url: HiddenText,
|
|
307
|
+
rev_options: RevOptions,
|
|
308
|
+
verbosity: int = 0,
|
|
309
|
+
) -> None:
|
|
305
310
|
cmd_args = make_command(
|
|
306
311
|
"switch",
|
|
307
312
|
self.get_remote_call_options(),
|
|
@@ -311,7 +316,13 @@ class Subversion(VersionControl):
|
|
|
311
316
|
)
|
|
312
317
|
self.run_command(cmd_args)
|
|
313
318
|
|
|
314
|
-
def update(
|
|
319
|
+
def update(
|
|
320
|
+
self,
|
|
321
|
+
dest: str,
|
|
322
|
+
url: HiddenText,
|
|
323
|
+
rev_options: RevOptions,
|
|
324
|
+
verbosity: int = 0,
|
|
325
|
+
) -> None:
|
|
315
326
|
cmd_args = make_command(
|
|
316
327
|
"update",
|
|
317
328
|
self.get_remote_call_options(),
|