Skip to content

Commit df647c3

Browse files
authored
Fixes issue I've been having running pipenv as an editable install on windows. (#5770)
1 parent 0a8f1aa commit df647c3

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

pipenv/__init__.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
1+
import importlib.util
12
import os
3+
import sys
24
import warnings
35

6+
7+
def _ensure_modules():
8+
spec = importlib.util.spec_from_file_location(
9+
"typing_extensions",
10+
location=os.path.join(
11+
os.path.dirname(__file__), "patched", "pip", "_vendor", "typing_extensions.py"
12+
),
13+
)
14+
typing_extensions = importlib.util.module_from_spec(spec)
15+
sys.modules["typing_extensions"] = typing_extensions
16+
spec.loader.exec_module(typing_extensions)
17+
18+
19+
_ensure_modules()
20+
421
from pipenv.__version__ import __version__ # noqa
5-
from pipenv.cli import cli
6-
from pipenv.patched.pip._vendor.urllib3.exceptions import DependencyWarning
22+
from pipenv.cli import cli # noqa
23+
from pipenv.patched.pip._vendor.urllib3.exceptions import DependencyWarning # noqa
724

825
warnings.filterwarnings("ignore", category=DependencyWarning)
926
warnings.filterwarnings("ignore", category=ResourceWarning)

pipenv/resolver.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88

99

1010
def _ensure_modules():
11+
spec = importlib.util.spec_from_file_location(
12+
"typing_extensions",
13+
location=os.path.join(
14+
os.path.dirname(__file__), "patched", "pip", "_vendor", "typing_extensions.py"
15+
),
16+
)
17+
typing_extensions = importlib.util.module_from_spec(spec)
18+
sys.modules["typing_extensions"] = typing_extensions
19+
spec.loader.exec_module(typing_extensions)
1120
spec = importlib.util.spec_from_file_location(
1221
"pipenv", location=os.path.join(os.path.dirname(__file__), "__init__.py")
1322
)

0 commit comments

Comments
 (0)