summaryrefslogtreecommitdiff
path: root/dev-python/pipenv/files/pipenv-2023.9.8-inject-system-packages.patch
blob: cf211f1ab8469a2efa12051f067195d10a03b40d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From b6b25911c050f0bec192e5ccb09ddc6dc3d5fa7d Mon Sep 17 00:00:00 2001
From: Oz Tiram <oz.tiram@gmail.com>
Date: Wed, 20 Sep 2023 23:03:57 +0200
Subject: [PATCH 1/4] Inject system packages

---
 pipenv/patched/pip/__main__.py | 8 ++++++++
 pipenv/resolver.py             | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/pipenv/patched/pip/__main__.py b/pipenv/patched/pip/__main__.py
index 032297163..59f7ad19e 100644
--- a/pipenv/patched/pip/__main__.py
+++ b/pipenv/patched/pip/__main__.py
@@ -21,10 +21,18 @@ if __package__ == "":
 if __name__ == "__main__":
     import importlib.util
     import sys
+
+    SITE_PACKAGES_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
+
+    # Inject site directory into system path.
+    sys.path.insert(-1, SITE_PACKAGES_ROOT)
+
     spec = importlib.util.spec_from_file_location(
         "pipenv", location=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "__init__.py"))
     pipenv = importlib.util.module_from_spec(spec)
     sys.modules["pipenv"] = pipenv
+
+
     spec.loader.exec_module(pipenv)
     from pipenv.patched.pip._internal.cli.main import main as _main
 
diff --git a/pipenv/resolver.py b/pipenv/resolver.py
index 82e01ca39..29461b878 100644
--- a/pipenv/resolver.py
+++ b/pipenv/resolver.py
@@ -10,6 +10,12 @@ except ImportError:
     cached_property = property
 
 
+SITE_PACKAGES_ROOT = os.path.dirname(os.path.dirname(__file__))
+
+# Inject site directory into system path.
+sys.path.insert(-1, SITE_PACKAGES_ROOT)
+
+
 def _ensure_modules():
     spec = importlib.util.spec_from_file_location(
         "typing_extensions",
-- 
2.41.0