[jhbuild/feature/regex-based-include-searching] introduce c_include_glob
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild/feature/regex-based-include-searching] introduce c_include_glob
- Date: Sat, 15 May 2021 15:41:01 +0000 (UTC)
commit b4e41b362c218918f89d10a8ed5ec7585303b35d
Author: Sebastian Geiger <sbastig gmx net>
Date: Sat May 15 17:40:52 2021 +0200
introduce c_include_glob
jhbuild/utils/systeminstall.py | 20 ++++++++++++++++++++
modulesets/gnome-sysdeps-latest.modules | 1 +
2 files changed, 21 insertions(+)
---
diff --git a/jhbuild/utils/systeminstall.py b/jhbuild/utils/systeminstall.py
index 52fb3fdb..292a7a48 100644
--- a/jhbuild/utils/systeminstall.py
+++ b/jhbuild/utils/systeminstall.py
@@ -27,6 +27,7 @@ import subprocess
import textwrap
import time
import re
+import fnmatch
from .compat import TextIO
from . import cmds
@@ -192,6 +193,25 @@ def systemdependencies_met(module_name, sysdeps, config):
break
if not found:
dep_met = False
+ elif dep_type.lower() == 'c_include_glob':
+ if c_include_search_paths is None:
+ c_include_search_paths = get_c_include_search_paths(config)
+
+ for path in c_include_search_paths:
+ if not os.path.isabs(value):
+ filename_glob = os.path.normpath(os.path.join(path, value))
+ else:
+ filename_glob = value
+
+ # value is a regex, do a tree walk and see if we can find a matching include
+ for root, dirs, files in os.walk(path):
+ for file in files:
+ candidate_filepath = os.path.join(root, file)
+ if fnmatch.fnmatch(candidate_filepath, filename_glob):
+ return True
+
+ dep_met = False
+
elif dep_type in ('python2', 'python3'):
command = dep_type
diff --git a/modulesets/gnome-sysdeps-latest.modules b/modulesets/gnome-sysdeps-latest.modules
index b06d7fd7..be04dd75 100644
--- a/modulesets/gnome-sysdeps-latest.modules
+++ b/modulesets/gnome-sysdeps-latest.modules
@@ -532,6 +532,7 @@
<systemdependencies>
<dep type="c_include" name="clang-c/Index.h">
<!-- Debian. FIXME: This is definitely broken. https://bugzilla.gnome.org/show_bug.cgi?id=781872 -->
+ <altdep type="c_include_glob" name="/usr/lib/llvm-*/include/clang-c/Index.h"/>
<altdep type="c_include" name="../lib/llvm-.*/include/clang-c/Index.h" regex="true" />
<!-- FreeBSD -->
<altdep type="c_include" name="../llvm90/include/clang-c/Index.h"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]