From 864155c935e448156d267079a56cd386508e0d58 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sat, 1 Jul 2023 09:38:04 -0400 Subject: [PATCH] Fixes issue I've been having running pipenv as an editable install on windows. --- pipenv/__init__.py | 21 +++++++++++++++++++-- pipenv/resolver.py | 9 +++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/pipenv/__init__.py b/pipenv/__init__.py index c5c476b3b0..ae87ade476 100644 --- a/pipenv/__init__.py +++ b/pipenv/__init__.py @@ -1,9 +1,26 @@ +import importlib.util import os +import sys 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.cli import cli -from pipenv.patched.pip._vendor.urllib3.exceptions import DependencyWarning +from pipenv.cli import cli # noqa +from pipenv.patched.pip._vendor.urllib3.exceptions import DependencyWarning # noqa warnings.filterwarnings("ignore", category=DependencyWarning) warnings.filterwarnings("ignore", category=ResourceWarning) diff --git a/pipenv/resolver.py b/pipenv/resolver.py index eb24669ad4..5e9ca5bf82 100644 --- a/pipenv/resolver.py +++ b/pipenv/resolver.py @@ -8,6 +8,15 @@ 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( "pipenv", location=os.path.join(os.path.dirname(__file__), "__init__.py") )