diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2022-09-18 21:10:21 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-09-28 00:17:42 -0400 |
commit | ed129a53118b417d95d1554a0ccf4286606ef69b (patch) | |
tree | ae7f757c1f8667a3a26a616da40f171ce5d8dad7 | |
parent | b9e382835e418f2c6c926313b3c84605cf87a9e1 (diff) | |
download | meson-ed129a53118b417d95d1554a0ccf4286606ef69b.zip meson-ed129a53118b417d95d1554a0ccf4286606ef69b.tar.gz meson-ed129a53118b417d95d1554a0ccf4286606ef69b.tar.bz2 |
wrap: If the directory exists in a sub-subproject, uses it inplace
A subproject could have a sub-subproject as a git submodule, or part of
the subproject's release tarball, and still have a wrap file for it
(e.g. needed for [provide] section). In that case we need to use the
source tree for the sub-subproject inplace instead of downloading a new
copy into the main project.
This is the case with GLib 2.74, it has a subproject "gvdb" as git
submodule, and part of release tarball, it ships gvdb.wrap file as well.
5 files changed, 16 insertions, 4 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 86dd74e..10aa1b8 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -346,10 +346,13 @@ class Resolver: self.directory = self.wrap.directory if self.wrap.has_wrap: - # We have a .wrap file, source code will be placed into main - # project's subproject_dir even if the wrap file comes from another - # subproject. - self.dirname = os.path.join(self.subdir_root, self.directory) + # We have a .wrap file, use directory relative to the location of + # the wrap file if it exists, otherwise source code will be placed + # into main project's subproject_dir even if the wrap file comes + # from another subproject. + self.dirname = os.path.join(os.path.dirname(self.wrap.filename), self.wrap.directory) + if not os.path.exists(self.dirname): + self.dirname = os.path.join(self.subdir_root, self.directory) # Check if the wrap comes from the main project. main_fname = os.path.join(self.subdir_root, self.wrap.basename) if self.wrap.filename != main_fname: diff --git a/test cases/common/254 subsubproject inplace/meson.build b/test cases/common/254 subsubproject inplace/meson.build new file mode 100644 index 0000000..26a421b --- /dev/null +++ b/test cases/common/254 subsubproject inplace/meson.build @@ -0,0 +1,3 @@ +project('main') + +subproject('sub') diff --git a/test cases/common/254 subsubproject inplace/subprojects/sub/meson.build b/test cases/common/254 subsubproject inplace/subprojects/sub/meson.build new file mode 100644 index 0000000..5e33d21 --- /dev/null +++ b/test cases/common/254 subsubproject inplace/subprojects/sub/meson.build @@ -0,0 +1,3 @@ +project('sub') + +subproject('subsub') diff --git a/test cases/common/254 subsubproject inplace/subprojects/sub/subprojects/subsub-1.0/meson.build b/test cases/common/254 subsubproject inplace/subprojects/sub/subprojects/subsub-1.0/meson.build new file mode 100644 index 0000000..7807a1b --- /dev/null +++ b/test cases/common/254 subsubproject inplace/subprojects/sub/subprojects/subsub-1.0/meson.build @@ -0,0 +1 @@ +project('subsub') diff --git a/test cases/common/254 subsubproject inplace/subprojects/sub/subprojects/subsub.wrap b/test cases/common/254 subsubproject inplace/subprojects/sub/subprojects/subsub.wrap new file mode 100644 index 0000000..bf39852 --- /dev/null +++ b/test cases/common/254 subsubproject inplace/subprojects/sub/subprojects/subsub.wrap @@ -0,0 +1,2 @@ +[wrap-file] +directory = subsub-1.0 |