Skip to content

Commit 1cc03ea

Browse files
authored
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
1 parent d118cc7 commit 1cc03ea

File tree

4 files changed

+6
-15
lines changed

4 files changed

+6
-15
lines changed

news/5719.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove the ``sys.path`` modifications and as a result fixes keyring support.

pipenv/__init__.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
1-
# |~~\' |~~
2-
# |__/||~~\|--|/~\\ /
3-
# | ||__/|__| |\/
4-
# |
5-
61
import os
7-
import sys
82
import warnings
93

10-
from pipenv.__version__ import __version__ # noqa
4+
from pipenv.cli import cli
115
from pipenv.patched.pip._vendor.urllib3.exceptions import DependencyWarning
126

137
warnings.filterwarnings("ignore", category=DependencyWarning)
148
warnings.filterwarnings("ignore", category=ResourceWarning)
159
warnings.filterwarnings("ignore", category=UserWarning)
16-
PIPENV_ROOT = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
17-
PIPENV_VENDOR = os.sep.join([PIPENV_ROOT, "vendor"])
18-
PIP_VENDOR = os.sep.join([PIPENV_ROOT, "patched", "pip", "_vendor"])
1910

2011
# Load patched pip instead of system pip
2112
os.environ["PIP_DISABLE_PIP_VERSION_CHECK"] = "1"
22-
sys.path.insert(0, PIPENV_ROOT)
23-
sys.path.insert(0, PIPENV_VENDOR)
24-
sys.path.insert(0, PIP_VENDOR)
2513

2614
if os.name == "nt":
2715
from pipenv.vendor import colorama
@@ -30,8 +18,6 @@
3018
if not os.getenv("NO_COLOR") or no_color:
3119
colorama.just_fix_windows_console()
3220

33-
from . import resolver # noqa: F401,E402
34-
from .cli import cli # noqa: E402
3521

3622
if __name__ == "__main__":
3723
cli()

pipenv/cli/command.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,7 @@ def run_open(state, module, *args, **kwargs):
668668
@system_option
669669
@option("--bare", is_flag=True, default=False, help="Minimal output.")
670670
@sync_options
671+
@site_packages_option
671672
@pass_state
672673
@pass_context
673674
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):
687688
system=state.system,
688689
extra_pip_args=state.installstate.extra_pip_args,
689690
categories=state.installstate.categories,
691+
site_packages=state.site_packages,
690692
)
691693
if retcode:
692694
ctx.abort()

pipenv/routines/install.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ def do_sync(
354354
deploy=False,
355355
extra_pip_args=None,
356356
categories=None,
357+
site_packages=False,
357358
):
358359
# The lock file needs to exist because sync won't write to it.
359360
if not project.lockfile_exists:
@@ -368,6 +369,7 @@ def do_sync(
368369
deploy=deploy,
369370
pypi_mirror=pypi_mirror,
370371
clear=clear,
372+
site_packages=site_packages,
371373
)
372374

373375
# Install everything.

0 commit comments

Comments
 (0)