Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
4 changes: 4 additions & 0 deletions lddwrap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def _parse_line(line: str) -> Optional[Dependency]:

"""
found = not 'not found' in line
no_version_info = 'no version information available' in line
Comment thread
altendky marked this conversation as resolved.
Outdated
parts = [part.strip() for part in line.split(' ')]
# pylint: disable=line-too-long
# There are two types of outputs for a dependency, with or without soname.
Expand Down Expand Up @@ -162,6 +163,9 @@ def _parse_line(line: str) -> Optional[Dependency]:
soname=soname, path=dep_path, found=found, mem_address=mem_address)
else:
if len(parts) != 2:
if no_version_info:
Comment thread
altendky marked this conversation as resolved.
Outdated
return None

raise RuntimeError(
"Expected 2 parts in the line but found {}: {}".format(
len(parts), line))
Expand Down
16 changes: 15 additions & 1 deletion tests/test_ldd.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def test_parse_wrong_line(self):
# ``parse_line`` raises a RuntimeError when it receives an unexpected
# structured line
run_err = None # type: Optional[RuntimeError]
line = "some wrong data which does not make sense"
line = "\tsome wrong data which does not make sense"
try:
lddwrap._parse_line(line=line) # pylint: disable=protected-access
except RuntimeError as err:
Expand All @@ -141,6 +141,20 @@ def test_parse_wrong_line(self):
'Expected 2 parts in the line but found {}: {}'.format(
line.count(' ') + 1, line), str(run_err))

def test_parse_non_indented_line(self):
"""Lines without leading indentation, at this point in processing, are
informational.
"""
# https://github.com/Parquery/pylddwrap/pull/14
line = (
"qt/6.0.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so:" +
" /lib/x86_64-linux-gnu/libpq.so.5:" +
" no version information available" +
" (required by qt/6.0.2/gcc_64/plugins/sqldrivers/libqsqlpsql.so)")
result = lddwrap._parse_line(line=line) # pylint: disable=protected-access

self.assertIsNone(result)

def test_parse_static(self) -> None:
"""Test parsing of the output when we ldd a static library."""
# pylint: disable=protected-access
Expand Down