Commit d78b57f2 by Sébastien Eustace

Improve output of the debug resolve command

parent 4300d607
...@@ -94,6 +94,8 @@ class DebugResolveCommand(Command): ...@@ -94,6 +94,8 @@ class DebugResolveCommand(Command):
current_python_version = parse_constraint( current_python_version = parse_constraint(
".".join(str(v) for v in env.version_info) ".".join(str(v) for v in env.version_info)
) )
table = self.table([], style="borderless")
rows = []
for op in ops: for op in ops:
pkg = op.package pkg = op.package
if self.option("install"): if self.option("install"):
...@@ -101,17 +103,19 @@ class DebugResolveCommand(Command): ...@@ -101,17 +103,19 @@ class DebugResolveCommand(Command):
current_python_version current_python_version
) or not env.is_valid_for_marker(pkg.marker): ) or not env.is_valid_for_marker(pkg.marker):
continue continue
row = [
self.line( "<info>{}</info>".format(pkg.name),
" - <info>{}</info> (<comment>{}</comment>)".format( "<b>{}</b>".format(pkg.version),
pkg.name, pkg.version "",
) ]
)
if not pkg.python_constraint.is_any():
self.line(" - python: {}".format(pkg.python_versions))
if not pkg.marker.is_any(): if not pkg.marker.is_any():
self.line(" - marker: {}".format(pkg.marker)) row[2] = str(pkg.marker)
rows.append(row)
table.set_rows(rows)
table.render(self.io)
def _determine_requirements(self, requires): # type: (List[str]) -> List[str] def _determine_requirements(self, requires): # type: (List[str]) -> List[str]
from poetry.semver import parse_constraint from poetry.semver import parse_constraint
......
...@@ -21,8 +21,8 @@ Resolving dependencies... ...@@ -21,8 +21,8 @@ Resolving dependencies...
Resolution results: Resolution results:
- msgpack-python (0.5.3) msgpack-python 0.5.3
- cachy (0.2.0) cachy 0.2.0
""" """
assert expected == tester.io.fetch_output() assert expected == tester.io.fetch_output()
...@@ -67,8 +67,8 @@ Resolving dependencies... ...@@ -67,8 +67,8 @@ Resolving dependencies...
Resolution results: Resolution results:
- pendulum (2.0.3) pendulum 2.0.3
- demo (0.1.2) demo 0.1.2
""" """
assert expected == tester.io.fetch_output() assert expected == tester.io.fetch_output()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment