pkgconfig generator: Remove duplicates in required versions

pull/3366/head
Xavier Claessens 7 years ago
parent 142f51a7b5
commit da0f0f02e5
  1. 8
      mesonbuild/modules/pkgconfig.py
  2. 4
      test cases/common/51 pkgconfig-gen/dependencies/meson.build

@ -133,9 +133,11 @@ class DependenciesHelper:
def add_version_reqs(self, name, version_reqs):
if version_reqs:
vreqs = self.version_reqs.get(name, [])
vreqs += mesonlib.stringlistify(version_reqs)
self.version_reqs[name] = vreqs
if name not in self.version_reqs:
self.version_reqs[name] = set()
# We could have '>=1.0' or '>= 1.0', remove spaces to normalize
new_vreqs = [s.replace(' ', '') for s in mesonlib.stringlistify(version_reqs)]
self.version_reqs[name].update(new_vreqs)
def split_version_req(self, s):
for op in ['>=', '<=', '!=', '==', '=', '>', '<']:

@ -11,6 +11,7 @@ pkgg.generate(exposed_lib)
# Declare a few different Dependency objects
pc_dep = dependency('libfoo', version : '>=1.0')
pc_dep_dup = dependency('libfoo', version : '>= 1.0')
notfound_dep = dependency('notfound', required : false)
threads_dep = dependency('threads')
custom_dep = declare_dependency(link_args : ['-lcustom'], compile_args : ['-DCUSTOM'])
@ -24,9 +25,10 @@ custom2_dep = declare_dependency(link_args : ['-lcustom2'], compile_args : ['-DC
# - Having custom_dep in libraries and libraries_private should only add it in Libs
# - Having custom2_dep in libraries_private should not add its Cflags
# - Having pc_dep in libraries_private should add it in Requires.private
# - pc_dep_dup is the same library and same version, should be ignored
# - notfound_dep is not required so it shouldn't appear in the pc file.
pkgg.generate(libraries : [main_lib, exposed_lib, threads_dep , custom_dep],
libraries_private : [custom_dep, custom2_dep, pc_dep, notfound_dep],
libraries_private : [custom_dep, custom2_dep, pc_dep, pc_dep_dup, notfound_dep],
version : '1.0',
name : 'dependency-test',
filebase : 'dependency-test',

Loading…
Cancel
Save