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

Correctly pass verbosity to resolver #2732

Merged
merged 2 commits into from
Aug 12, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
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