diff options
author | fghzxm <fghzxm@outlook.com> | 2022-05-09 12:53:58 +0800 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2022-05-09 21:42:02 +0200 |
commit | 7650f328284f24c2f70dcfb1689ae8fc22c04cf1 (patch) | |
tree | 5ca75de87fa19b44899371e4edf7fff81bfaefd8 /mesonbuild | |
parent | aa874ea0d020aee90595c2adfb43866fcaabfdb7 (diff) | |
download | meson-7650f328284f24c2f70dcfb1689ae8fc22c04cf1.zip meson-7650f328284f24c2f70dcfb1689ae8fc22c04cf1.tar.gz meson-7650f328284f24c2f70dcfb1689ae8fc22c04cf1.tar.bz2 |
dependencies/boost.py: ignore unknown files
If we encounter a file under the Boost library directory that doesn't
look like a Boost library binary, we should ignore it.
We log a warning for each file we ignore, except for ones we know are
safe to ignore (e. g. PDB files from the SourceForge Windows
distribution). This should avoid polluting the log.
Fixes #8325.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/dependencies/boost.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py index 544e844..8c552f5 100644 --- a/mesonbuild/dependencies/boost.py +++ b/mesonbuild/dependencies/boost.py @@ -13,6 +13,7 @@ # limitations under the License. import re +import dataclasses import functools import typing as T from pathlib import Path @@ -83,6 +84,10 @@ if T.TYPE_CHECKING: # 2.4 Ensure that all libraries have the same boost tag (and are thus compatible) # 3. Select the libraries matching the requested modules +@dataclasses.dataclass(eq=False, order=False) +class UnknownFileException(Exception): + path: Path + @functools.total_ordering class BoostIncludeDir(): def __init__(self, path: Path, version_int: int): @@ -152,7 +157,7 @@ class BoostLibraryFile(): elif self.nvsuffix in ['a', 'lib']: self.static = True else: - raise DependencyException(f'Unable to process library extension "{self.nvsuffix}" ({self.path})') + raise UnknownFileException(self.path) # boost_.lib is the dll import library if self.basename.startswith('boost_') and self.nvsuffix == 'lib': @@ -623,8 +628,15 @@ class BoostDependency(SystemDependency): continue if not any([i.name.startswith(x) for x in ['libboost_', 'boost_']]): continue + # Windows binaries from SourceForge ship with PDB files alongside + # DLLs (#8325). Ignore them. + if i.name.endswith('.pdb'): + continue - libs.add(BoostLibraryFile(i.resolve())) + try: + libs.add(BoostLibraryFile(i.resolve())) + except UnknownFileException as e: + mlog.warning('Boost: ignoring unknown file {} under lib directory'.format(e.path.name)) return [x for x in libs if x.is_boost()] # Filter out no boost libraries |