Skip to content

Commit

Permalink
Merge pull request #2732 from pypa/bugfix/pass-verbosity-to-resolver
Browse files Browse the repository at this point in the history
Correctly pass verbosity to resolver
  • Loading branch information
techalchemy authored Aug 12, 2018
2 parents 45c337a + f4f8f10 commit 541b87a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions news/2732.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Correctly pass `verbose` and `debug` flags to the resolver subprocess so it generates appropriate output. This also resolves a bug introduced by the fix to #2527.
13 changes: 10 additions & 3 deletions pipenv/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def which(*args, **kwargs):
def main():
do_pre = "--pre" in " ".join(sys.argv)
do_clear = "--clear" in " ".join(sys.argv)
is_verbose = "--verbose" in " ".join(sys.argv)
is_debug = "--debug" in " ".join(sys.argv)
system = "--system" in " ".join(sys.argv)
new_sys_argv = []
Expand All @@ -35,11 +36,17 @@ def main():

os.environ["PIP_PYTHON_VERSION"] = ".".join([str(s) for s in sys.version_info[:3]])
os.environ["PIP_PYTHON_PATH"] = sys.executable
if int(os.environ.get("PIPENV_VERBOSITY", 0)) > 0:
logging.getLogger("notpip").setLevel(logging.INFO)

verbosity = int(os.environ.get("PIPENV_VERBOSITY", 0))
if is_debug:
# Shit's getting real at this point.
verbosity = max(verbosity, 2)
elif is_verbose:
verbosity = max(verbosity, 1)
if verbosity > 1: # Shit's getting real at this point.
logging.getLogger("notpip").setLevel(logging.DEBUG)
elif verbosity > 0:
logging.getLogger("notpip").setLevel(logging.INFO)

if "PIPENV_PACKAGES" in os.environ:
packages = os.environ["PIPENV_PACKAGES"].strip().split("\n")
else:
Expand Down
4 changes: 2 additions & 2 deletions pipenv/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,18 @@ def venv_resolve_deps(
if not deps:
return []
resolver = escape_grouped_arguments(resolver.__file__.rstrip("co"))
cmd = "{0} {1} {2} {3} {4} {5}".format(
cmd = "{0} {1} {2} {3} {4}".format(
escape_grouped_arguments(which("python", allow_global=allow_global)),
resolver,
"--pre" if pre else "",
"--verbose" if (environments.is_verbose()) else "",
"--clear" if clear else "",
"--system" if allow_global else "",
)
with temp_environ():
os.environ["PIPENV_PACKAGES"] = "\n".join(deps)
if pypi_mirror:
os.environ["PIPENV_PYPI_MIRROR"] = str(pypi_mirror)
os.environ["PIPENV_VERBOSITY"] = str(environments.PIPENV_VERBOSITY)
c = delegator.run(cmd, block=True)
try:
assert c.return_code == 0
Expand Down

0 comments on commit 541b87a

Please sign in to comment.