boost: Fix boost_python detection on bionic (fixes #6886 #4788)

0.54
Daniel Mensinger 5 years ago committed by Nirbheek Chauhan
parent b69d3e1779
commit 668f1528e0
  1. 37
      mesonbuild/dependencies/boost.py
  2. 2
      test cases/frameworks/1 boost/meson.build

@ -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

@ -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()

Loading…
Cancel
Save