From 3f8e5e7c382f215bc7407b08e914bcc2d3a92f48 Mon Sep 17 00:00:00 2001 From: "Brett T. Warden" Date: Tue, 1 Oct 2024 10:44:00 -0700 Subject: [PATCH] parse_cmake: Also match hypen in pkg_check_modules(X) If a cmake file defines a pkgconfig dependency with a hypen in it, make sure we can handle it: pkg_check_modules(DBUS-1 REQUIRED dbus-1 IMPORTED_TARGET) Previously we used \w to match the first term (DBUS-1), which does *not* match hyphens. --- autospec/buildreq.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autospec/buildreq.py b/autospec/buildreq.py index e0235aac..b8d5c9fa 100644 --- a/autospec/buildreq.py +++ b/autospec/buildreq.py @@ -508,7 +508,7 @@ def parse_cmake(self, filename, cmake_modules, conf32): """Scan a .cmake or CMakeLists.txt file for what's it's actually looking for.""" findpackage = re.compile(r"^[^#]*find_package\((\w+)\b.*\)", re.I) findpackage_multiline = re.compile(r"^[^#]*find_package\((\w+)\b.*", re.I) - pkgconfig = re.compile(r"^[^#]*pkg_check_modules\s*\(\w+ (.*)\)", re.I) + pkgconfig = re.compile(r"^[^#]*pkg_check_modules\s*\([\w\-]+ (.*)\)", re.I) pkg_search_modifiers = {'REQUIRED', 'QUIET', 'NO_CMAKE_PATH', 'NO_CMAKE_ENVIRONMENT_PATH', 'IMPORTED_TARGET'} extractword = re.compile(r'(?:"([^"]+)"|(\S+))(.*)')