Remove the sys path hacks (again) to fix edge cases with keyring (#5732)

* Remove the sys path hacks (again) to see where things break.
* Add site packages to sync
This commit is contained in:
Matt Davis
2023-06-11 21:01:57 -04:00
committed by GitHub
parent d118cc77eb
commit 1cc03eaa3b
4 changed files with 6 additions and 15 deletions
+1
View File
@@ -0,0 +1 @@
Remove the ``sys.path`` modifications and as a result fixes keyring support.
+1 -15
View File
@@ -1,27 +1,15 @@
# |~~\' |~~
# |__/||~~\|--|/~\\ /
# | ||__/|__| |\/
# |
import os
import sys
import warnings
from pipenv.__version__ import __version__ # noqa
from pipenv.cli import cli
from pipenv.patched.pip._vendor.urllib3.exceptions import DependencyWarning
warnings.filterwarnings("ignore", category=DependencyWarning)
warnings.filterwarnings("ignore", category=ResourceWarning)
warnings.filterwarnings("ignore", category=UserWarning)
PIPENV_ROOT = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
PIPENV_VENDOR = os.sep.join([PIPENV_ROOT, "vendor"])
PIP_VENDOR = os.sep.join([PIPENV_ROOT, "patched", "pip", "_vendor"])
# Load patched pip instead of system pip
os.environ["PIP_DISABLE_PIP_VERSION_CHECK"] = "1"
sys.path.insert(0, PIPENV_ROOT)
sys.path.insert(0, PIPENV_VENDOR)
sys.path.insert(0, PIP_VENDOR)
if os.name == "nt":
from pipenv.vendor import colorama
@@ -30,8 +18,6 @@ if os.name == "nt":
if not os.getenv("NO_COLOR") or no_color:
colorama.just_fix_windows_console()
from . import resolver # noqa: F401,E402
from .cli import cli # noqa: E402
if __name__ == "__main__":
cli()
+2
View File
@@ -668,6 +668,7 @@ def run_open(state, module, *args, **kwargs):
@system_option
@option("--bare", is_flag=True, default=False, help="Minimal output.")
@sync_options
@site_packages_option
@pass_state
@pass_context
def sync(ctx, state, bare=False, user=False, unused=False, **kwargs):
@@ -687,6 +688,7 @@ def sync(ctx, state, bare=False, user=False, unused=False, **kwargs):
system=state.system,
extra_pip_args=state.installstate.extra_pip_args,
categories=state.installstate.categories,
site_packages=state.site_packages,
)
if retcode:
ctx.abort()
+2
View File
@@ -354,6 +354,7 @@ def do_sync(
deploy=False,
extra_pip_args=None,
categories=None,
site_packages=False,
):
# The lock file needs to exist because sync won't write to it.
if not project.lockfile_exists:
@@ -368,6 +369,7 @@ def do_sync(
deploy=deploy,
pypi_mirror=pypi_mirror,
clear=clear,
site_packages=site_packages,
)
# Install everything.