10 """ Portable python script to check if subproject is up-to-date and warn if not """
16 subproject = sys.argv[1]
17 meson_root = os.environ[
"MESON_SOURCE_ROOT"]
19 subproject_filename = os.path.join(meson_root,
"subprojects", subproject +
".wrap")
22 with open(subproject_filename,
"r", encoding=
"utf8")
as f:
25 directory = subproject
26 patch_directory = subproject
30 elif "wrap-file" in l:
32 elif l.startswith(
"revision"):
33 revision = l.split(
"=")[1].
strip()
34 elif l.startswith(
"directory"):
35 directory = l.split(
"=")[1].
strip()
36 elif l.startswith(
"patch_directory"):
37 patch_directory = l.split(
"=")[1].
strip()
43 subproject_dir = os.path.join(meson_root,
"subprojects", directory)
44 subproject_git_dir = os.path.join(subproject_dir,
".git")
45 if os.path.isdir(subproject_dir)
and os.path.isdir(subproject_git_dir):
47 os.path.join(subproject_git_dir,
"HEAD"),
"r", encoding=
"utf8"
51 if head != revision
and revision
not in head:
54 if not patch_directory:
57 subproject_dir = os.path.join(meson_root,
"subprojects", directory)
58 patch_subproject_dir = os.path.join(
59 meson_root,
"subprojects",
"packagefiles", patch_directory
61 if os.path.isdir(patch_subproject_dir)
and os.path.isdir(subproject_dir):
62 for root, dirs, files
in os.walk(patch_subproject_dir, topdown=
False):
64 subproject_f = os.path.join(root, name)
65 subproject_p_f = subproject_f.replace(
66 patch_subproject_dir, subproject_dir
68 if not os.path.isfile(subproject_f):
71 if not filecmp.cmp(subproject_p_f, subproject_f):
75 except FileNotFoundError: