diff options
-rw-r--r-- | mesonbuild/dependencies/boost.py | 37 | ||||
-rw-r--r-- | test cases/frameworks/1 boost/meson.build | 2 |
2 files changed, 38 insertions, 1 deletions
diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py index d35069e..ff82a03 100644 --- a/mesonbuild/dependencies/boost.py +++ b/mesonbuild/dependencies/boost.py @@ -152,6 +152,9 @@ class BoostLibraryFile(): # Process tags tags = self.nametags[1:] + # Filter out the python version tag and fix modname + if self.is_python_lib(): + tags = self.fix_python_name(tags) if not tags: return @@ -226,6 +229,40 @@ class BoostLibraryFile(): def is_python_lib(self) -> bool: return any([self.mod_name.startswith(x) for x in BoostLibraryFile.boost_python_libs]) + def fix_python_name(self, tags: T.List[str]) -> T.List[str]: + # Handle the boost_python naming madeness. + # See https://github.com/mesonbuild/meson/issues/4788 for some distro + # specific naming variantions. + other_tags = [] # type: T.List[str] + + # Split the current modname into the base name and the version + m_cur = BoostLibraryFile.reg_python_mod_split.match(self.mod_name) + cur_name = m_cur.group(1) + cur_vers = m_cur.group(2) + + # Update the current version string if the new version string is longer + def update_vers(new_vers: str) -> None: + nonlocal cur_vers + new_vers = new_vers.replace('_', '') + new_vers = new_vers.replace('.', '') + if not new_vers.isdigit(): + return + if len(new_vers) > len(cur_vers): + cur_vers = new_vers + + for i in tags: + if i.startswith('py'): + update_vers(i[2:]) + elif i.isdigit(): + update_vers(i) + elif len(i) >= 3 and i[0].isdigit and i[2].isdigit() and i[1] == '.': + update_vers(i) + else: + other_tags += [i] + + self.mod_name = cur_name + cur_vers + return other_tags + def mod_name_matches(self, mod_name: str) -> bool: if self.mod_name == mod_name: return True diff --git a/test cases/frameworks/1 boost/meson.build b/test cases/frameworks/1 boost/meson.build index cb8c2df..0bf8b40 100644 --- a/test cases/frameworks/1 boost/meson.build +++ b/test cases/frameworks/1 boost/meson.build @@ -36,7 +36,7 @@ else endif if(python3dep.found() and host_machine.system() == 'linux' and not s) - bpython3dep = dependency('boost', static: s, modules : ['python3'], required: false, disabler: true) + bpython3dep = dependency('boost', static: s, modules : ['python3']) else python3dep = disabler() bpython3dep = disabler() |