Skip to content

Commit 55a2075

Browse files
authored
Merge pull request #145 from wimglenn/issue-141
avoid wrapping by default. closes #141
2 parents 9ea11da + 0de0242 commit 55a2075

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

johnnydep/lib.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from shutil import rmtree
1616
from tempfile import mkdtemp
1717
from textwrap import dedent
18+
from unittest.mock import patch
1819
from urllib.parse import urlparse
1920
from zipfile import Path as zipfile_path
2021
from zipfile import ZipFile
@@ -291,7 +292,8 @@ def serialise(self, fields=("name", "summary"), recurse=True, format=None):
291292
tree.dist = self
292293
table = gen_table(tree, cols=cols)
293294
buf = io.StringIO()
294-
rich.print(table, file=buf)
295+
with patch.dict("os.environ", COLUMNS="1000"):
296+
rich.print(table, file=buf)
295297
raw = buf.getvalue()
296298
stripped = "\n".join([x.rstrip() for x in raw.splitlines() if x.strip()])
297299
result = dedent(stripped)
@@ -372,17 +374,18 @@ def gen_tree(johnnydist, with_specifier=True):
372374

373375
def gen_table(tree, cols):
374376
table = Table(box=rich.box.SIMPLE)
375-
table.add_column("name", overflow="fold")
377+
table.add_column("name", overflow="fold", no_wrap=True)
376378
for col in cols:
377-
table.add_column(col, overflow="fold")
379+
table.add_column(col, overflow="fold", no_wrap=True)
378380
rows = []
379381
stack = [tree]
380382
while stack:
381383
node = stack.pop()
382384
rows.append(node)
383385
stack += reversed(node.children)
384386
buf = io.StringIO()
385-
rich.print(tree, file=buf)
387+
with patch.dict("os.environ", COLUMNS="1000"):
388+
rich.print(tree, file=buf)
386389
tree_lines = buf.getvalue().splitlines()
387390
for row0, row in zip(tree_lines, rows):
388391
data = [getattr(row.dist, c) for c in cols]

0 commit comments

Comments
 (0)