Fixes issue I've been having running pipenv as an editable install on windows. (#5770)

This commit is contained in:
Matt Davis
2023-07-02 16:40:24 -04:00
committed by GitHub
parent 0a8f1aa00c
commit df647c378e
2 changed files with 28 additions and 2 deletions
+19 -2
View File
@@ -1,9 +1,26 @@
import importlib.util
import os import os
import sys
import warnings import warnings
def _ensure_modules():
spec = importlib.util.spec_from_file_location(
"typing_extensions",
location=os.path.join(
os.path.dirname(__file__), "patched", "pip", "_vendor", "typing_extensions.py"
),
)
typing_extensions = importlib.util.module_from_spec(spec)
sys.modules["typing_extensions"] = typing_extensions
spec.loader.exec_module(typing_extensions)
_ensure_modules()
from pipenv.__version__ import __version__ # noqa from pipenv.__version__ import __version__ # noqa
from pipenv.cli import cli from pipenv.cli import cli # noqa
from pipenv.patched.pip._vendor.urllib3.exceptions import DependencyWarning from pipenv.patched.pip._vendor.urllib3.exceptions import DependencyWarning # noqa
warnings.filterwarnings("ignore", category=DependencyWarning) warnings.filterwarnings("ignore", category=DependencyWarning)
warnings.filterwarnings("ignore", category=ResourceWarning) warnings.filterwarnings("ignore", category=ResourceWarning)
+9
View File
@@ -8,6 +8,15 @@ os.environ["PIP_PYTHON_PATH"] = str(sys.executable)
def _ensure_modules(): def _ensure_modules():
spec = importlib.util.spec_from_file_location(
"typing_extensions",
location=os.path.join(
os.path.dirname(__file__), "patched", "pip", "_vendor", "typing_extensions.py"
),
)
typing_extensions = importlib.util.module_from_spec(spec)
sys.modules["typing_extensions"] = typing_extensions
spec.loader.exec_module(typing_extensions)
spec = importlib.util.spec_from_file_location( spec = importlib.util.spec_from_file_location(
"pipenv", location=os.path.join(os.path.dirname(__file__), "__init__.py") "pipenv", location=os.path.join(os.path.dirname(__file__), "__init__.py")
) )