handle system install

This commit is contained in:
Frost Ming
2021-07-29 16:26:33 +08:00
parent 6ef9344a5f
commit c33b4eed9e
3 changed files with 9 additions and 9 deletions
+5 -6
View File
@@ -25,12 +25,11 @@ from pipenv.environments import (
from pipenv.patched import crayons
from pipenv.project import Project
from pipenv.utils import (
convert_deps_to_pip, create_spinner, download_file,
escape_grouped_arguments, find_python, find_windows_executable,
get_canonical_names, get_source_list, is_pinned, is_python_command,
is_required_version, is_star, is_valid_url, parse_indexes, pep423_name,
prepare_pip_source_args, proper_case, python_version, run_command,
subprocess_run, venv_resolve_deps
convert_deps_to_pip, create_spinner, download_file, find_python,
find_windows_executable, get_canonical_names, get_source_list, is_pinned,
is_python_command, is_required_version, is_star, is_valid_url,
parse_indexes, pep423_name, prepare_pip_source_args, proper_case,
python_version, run_command, subprocess_run, venv_resolve_deps
)
+2 -1
View File
@@ -350,7 +350,8 @@ class Project(object):
def get_environment(self, allow_global=False):
# type: (bool) -> Environment
is_venv = is_in_virtualenv() or is_using_venv()
if allow_global and not is_venv:
use_system = os.getenv('PIPENV_USE_SYSTEM') == '1'
if use_system or allow_global and not is_venv:
prefix = sys.prefix
python = sys.executable
else:
+2 -2
View File
@@ -1313,8 +1313,8 @@ def venv_resolve_deps(
results = c.stdout.strip()
if c.returncode == 0:
sp.green.ok(environments.PIPENV_SPINNER_OK_TEXT.format("Success!"))
if not environments.is_verbose() and c.stdout.strip():
click_echo(crayons.yellow(f"Warning: {c.stdout.strip()}"), err=True)
if not environments.is_verbose() and c.stderr.strip():
click_echo(crayons.yellow(f"Warning: {c.stderr.strip()}"), err=True)
else:
sp.red.fail(environments.PIPENV_SPINNER_FAIL_TEXT.format("Locking Failed!"))
click_echo(f"Output: {c.stdout.strip()}", err=True)