Commit fbb34ea9 authored by André Anjos's avatar André Anjos 💬

Merge branch '58-the-dboost_version-flag-has-unnecessary-and-unwanted-quotes' into 'master'

Resolve "The `-DBOOST_VERSION` flag has unnecessary and unwanted quotes"

Closes #58

See merge request !82
parents fb2b07f6 aaf2abae
Pipeline #20989 passed with stages
in 11 minutes and 37 seconds
......@@ -207,7 +207,7 @@ class boost:
>>> from bob.extension import boost
>>> pkg = boost('>= 1.34')
>>> pkg.macros()
[('HAVE_BOOST', '1'), ('BOOST_VERSION', '"..."')]
[('HAVE_BOOST', '1')]
"""
return [('HAVE_BOOST', '1'), ('BOOST_VERSION', '"%s"' % self.version)]
return [('HAVE_BOOST', '1')]
......@@ -372,9 +372,9 @@ class pkgconfig:
def package_macros(self):
"""Returns package availability and version number macros
This method returns a python list with 2 macros indicating package
availability and a version number, using standard GNU compatible names. For
example, if the package is named ``foo`` and its version is ``1.4``, this
This method returns a python list with 1 macro indicating package
availability, using standard GNU compatible names. For
example, if the package is named ``blitz``, this
command would return:
.. doctest::
......@@ -383,11 +383,11 @@ class pkgconfig:
>>> from bob.extension import pkgconfig
>>> blitz = pkgconfig('blitz')
>>> blitz.package_macros()
[('HAVE_BLITZ', '1'), ('BLITZ_VERSION', '"..."')]
[('HAVE_BLITZ', '1')]
"""
from re import sub
NAME = sub(r'[\.\-\s]', '_', self.name.upper())
return [('HAVE_' + NAME, '1'), (NAME + '_VERSION', '"%s"' % self.version)]
return [('HAVE_' + NAME, '1')]
__all__ = ['pkgconfig']
......@@ -45,10 +45,10 @@ def test_cflags_other():
#assert obj['extra_compile_args']
#assert isinstance(obj['extra_compile_args'], list)
#assert isinstance(obj['extra_compile_args'][0], tuple)
#assert obj['define_macros']
#assert isinstance(obj['define_macros'], list)
#assert isinstance(obj['define_macros'][0], tuple)
#assert isinstance(obj['define_macros'][0], tuple)
assert isinstance(obj, dict)
......@@ -107,9 +107,7 @@ def test_macros():
pkg = pkgconfig(test_package)
macros = pkg.package_macros()
assert isinstance(macros, list)
assert macros
assert len(macros) == 1
assert len(macros[0]) == 2
assert macros[0][0].find('HAVE_') == 0
assert macros[0][1] == '1'
assert macros[1][0].find('_VERSION') > 0
assert macros[1][1].find('"') == 0
assert macros[1][1].rfind('"') == (len(macros[1][1]) - 1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment