diff --git a/lddwrap/__init__.py b/lddwrap/__init__.py index 520bc07..2e915eb 100644 --- a/lddwrap/__init__.py +++ b/lddwrap/__init__.py @@ -162,6 +162,10 @@ def _parse_line(line: str) -> Optional[Dependency]: soname=soname, path=dep_path, found=found, mem_address=mem_address) else: if len(parts) != 2: + # Please see https://github.com/Parquery/pylddwrap/pull/14 + if 'no version information available' in line: + return None + raise RuntimeError( "Expected 2 parts in the line but found {}: {}".format( len(parts), line)) diff --git a/tests/test_ldd.py b/tests/test_ldd.py index e04859b..d10cf53 100644 --- a/tests/test_ldd.py +++ b/tests/test_ldd.py @@ -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: @@ -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