Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions pipenv/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -30,8 +18,6 @@
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 changes: 2 additions & 0 deletions pipenv/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions pipenv/routines/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -368,6 +369,7 @@ def do_sync(
deploy=deploy,
pypi_mirror=pypi_mirror,
clear=clear,
site_packages=site_packages,
)

# Install everything.
Expand Down