Skip to content

Commit e6533d5

Browse files
matteiusoz123
authored andcommitted
Add back updated patches that are relvant
1 parent 7099d2c commit e6533d5

File tree

3 files changed

+186
-0
lines changed

3 files changed

+186
-0
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
diff --git a/pipenv/patched/pip/_internal/commands/__init__.py b/pipenv/patched/pip/_internal/commands/__init__.py
2+
index bc4f216a8..156846015 100644
3+
--- a/pipenv/patched/pip/_internal/commands/__init__.py
4+
+++ b/pipenv/patched/pip/_internal/commands/__init__.py
5+
@@ -14,97 +14,97 @@ CommandInfo = namedtuple("CommandInfo", "module_path, class_name, summary")
6+
# - Enables avoiding additional (costly) imports for presenting `--help`.
7+
# - The ordering matters for help display.
8+
#
9+
-# Even though the module path starts with the same "pip._internal.commands"
10+
+# Even though the module path starts with the same "pipenv.patched.pip_internal.commands"
11+
# prefix, the full path makes testing easier (specifically when modifying
12+
# `commands_dict` in test setup / teardown).
13+
commands_dict: Dict[str, CommandInfo] = {
14+
"install": CommandInfo(
15+
- "pip._internal.commands.install",
16+
+ "pipenv.patched.pip_internal.commands.install",
17+
"InstallCommand",
18+
"Install packages.",
19+
),
20+
"lock": CommandInfo(
21+
- "pip._internal.commands.lock",
22+
+ "pipenv.patched.pip_internal.commands.lock",
23+
"LockCommand",
24+
"Generate a lock file.",
25+
),
26+
"download": CommandInfo(
27+
- "pip._internal.commands.download",
28+
+ "pipenv.patched.pip_internal.commands.download",
29+
"DownloadCommand",
30+
"Download packages.",
31+
),
32+
"uninstall": CommandInfo(
33+
- "pip._internal.commands.uninstall",
34+
+ "pipenv.patched.pip_internal.commands.uninstall",
35+
"UninstallCommand",
36+
"Uninstall packages.",
37+
),
38+
"freeze": CommandInfo(
39+
- "pip._internal.commands.freeze",
40+
+ "pipenv.patched.pip_internal.commands.freeze",
41+
"FreezeCommand",
42+
"Output installed packages in requirements format.",
43+
),
44+
"inspect": CommandInfo(
45+
- "pip._internal.commands.inspect",
46+
+ "pipenv.patched.pip_internal.commands.inspect",
47+
"InspectCommand",
48+
"Inspect the python environment.",
49+
),
50+
"list": CommandInfo(
51+
- "pip._internal.commands.list",
52+
+ "pipenv.patched.pip_internal.commands.list",
53+
"ListCommand",
54+
"List installed packages.",
55+
),
56+
"show": CommandInfo(
57+
- "pip._internal.commands.show",
58+
+ "pipenv.patched.pip_internal.commands.show",
59+
"ShowCommand",
60+
"Show information about installed packages.",
61+
),
62+
"check": CommandInfo(
63+
- "pip._internal.commands.check",
64+
+ "pipenv.patched.pip_internal.commands.check",
65+
"CheckCommand",
66+
"Verify installed packages have compatible dependencies.",
67+
),
68+
"config": CommandInfo(
69+
- "pip._internal.commands.configuration",
70+
+ "pipenv.patched.pip_internal.commands.configuration",
71+
"ConfigurationCommand",
72+
"Manage local and global configuration.",
73+
),
74+
"search": CommandInfo(
75+
- "pip._internal.commands.search",
76+
+ "pipenv.patched.pip_internal.commands.search",
77+
"SearchCommand",
78+
"Search PyPI for packages.",
79+
),
80+
"cache": CommandInfo(
81+
- "pip._internal.commands.cache",
82+
+ "pipenv.patched.pip_internal.commands.cache",
83+
"CacheCommand",
84+
"Inspect and manage pip's wheel cache.",
85+
),
86+
"index": CommandInfo(
87+
- "pip._internal.commands.index",
88+
+ "pipenv.patched.pip_internal.commands.index",
89+
"IndexCommand",
90+
"Inspect information available from package indexes.",
91+
),
92+
"wheel": CommandInfo(
93+
- "pip._internal.commands.wheel",
94+
+ "pipenv.patched.pip_internal.commands.wheel",
95+
"WheelCommand",
96+
"Build wheels from your requirements.",
97+
),
98+
"hash": CommandInfo(
99+
- "pip._internal.commands.hash",
100+
+ "pipenv.patched.pip_internal.commands.hash",
101+
"HashCommand",
102+
"Compute hashes of package archives.",
103+
),
104+
"completion": CommandInfo(
105+
- "pip._internal.commands.completion",
106+
+ "pipenv.patched.pip_internal.commands.completion",
107+
"CompletionCommand",
108+
"A helper command used for command completion.",
109+
),
110+
"debug": CommandInfo(
111+
- "pip._internal.commands.debug",
112+
+ "pipenv.patched.pip_internal.commands.debug",
113+
"DebugCommand",
114+
"Show information useful for debugging.",
115+
),
116+
"help": CommandInfo(
117+
- "pip._internal.commands.help",
118+
+ "pipenv.patched.pip_internal.commands.help",
119+
"HelpCommand",
120+
"Show help for commands.",
121+
),
122+
diff --git a/pipenv/patched/pip/_vendor/requests/packages.py b/pipenv/patched/pip/_vendor/requests/packages.py
123+
index 200c38287..c92ef2d0d 100644
124+
--- a/pipenv/patched/pip/_vendor/requests/packages.py
125+
+++ b/pipenv/patched/pip/_vendor/requests/packages.py
126+
@@ -6,14 +6,14 @@ from .compat import chardet
127+
# I don't like it either. Just look the other way. :)
128+
129+
for package in ("urllib3", "idna"):
130+
- vendored_package = "pip._vendor." + package
131+
+ vendored_package = "pipenv.patched.pip._vendor." + package
132+
locals()[package] = __import__(vendored_package)
133+
# This traversal is apparently necessary such that the identities are
134+
# preserved (requests.packages.urllib3.* is urllib3.*)
135+
for mod in list(sys.modules):
136+
if mod == vendored_package or mod.startswith(vendored_package + '.'):
137+
- unprefixed_mod = mod[len("pip._vendor."):]
138+
- sys.modules['pip._vendor.requests.packages.' + unprefixed_mod] = sys.modules[mod]
139+
+ unprefixed_mod = mod[len("pipenv.patched.pip._vendor."):]
140+
+ sys.modules['pipenv.patched.pip._vendor.requests.packages.' + unprefixed_mod] = sys.modules[mod]
141+
142+
if chardet is not None:
143+
target = chardet.__name__
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/pipenv/patched/pip/_internal/resolution/resolvelib/candidates.py b/pipenv/patched/pip/_internal/resolution/resolvelib/candidates.py
2+
index d976026ac..49706667c 100644
3+
--- a/pipenv/patched/pip/_internal/resolution/resolvelib/candidates.py
4+
+++ b/pipenv/patched/pip/_internal/resolution/resolvelib/candidates.py
5+
@@ -3,6 +3,7 @@ import sys
6+
from typing import TYPE_CHECKING, Any, FrozenSet, Iterable, Optional, Tuple, Union, cast
7+
8+
from pip._vendor.packaging.requirements import InvalidRequirement
9+
+from pip._vendor.packaging.specifiers import SpecifierSet
10+
from pip._vendor.packaging.utils import NormalizedName, canonicalize_name
11+
from pip._vendor.packaging.version import Version
12+
13+
@@ -257,7 +258,10 @@ class _InstallRequirementBackedCandidate(Candidate):
14+
yield from self._factory.make_requirements_from_spec(str(r), self._ireq)
15+
16+
def get_install_requirement(self) -> Optional[InstallRequirement]:
17+
- return self._ireq
18+
+ ireq = self._ireq
19+
+ if self._version and ireq.req and not ireq.req.url:
20+
+ ireq.req.specifier = SpecifierSet(f"=={self._version}")
21+
+ return ireq
22+
23+
24+
class LinkCandidate(_InstallRequirementBackedCandidate):
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff --git a/pipenv/patched/pip/__main__.py b/pipenv/patched/pip/__main__.py
2+
index 599132611..1fa416e9a 100644
3+
--- a/pipenv/patched/pip/__main__.py
4+
+++ b/pipenv/patched/pip/__main__.py
5+
@@ -19,6 +19,14 @@ if __package__ == "":
6+
sys.path.insert(0, path)
7+
8+
if __name__ == "__main__":
9+
+ import importlib.util
10+
+ import sys
11+
+ spec = importlib.util.spec_from_file_location(
12+
+ "pipenv",
13+
+ location=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "__init__.py"))
14+
+ pipenv = importlib.util.module_from_spec(spec)
15+
+ sys.modules["pipenv"] = pipenv
16+
+ spec.loader.exec_module(pipenv)
17+
from pip._internal.cli.main import main as _main
18+
19+
sys.exit(_main())

0 commit comments

Comments
 (0)