aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/wrap
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-09-18 21:10:21 -0400
committerEli Schwartz <eschwartz93@gmail.com>2022-09-28 00:17:42 -0400
commited129a53118b417d95d1554a0ccf4286606ef69b (patch)
treeae7f757c1f8667a3a26a616da40f171ce5d8dad7 /mesonbuild/wrap
parentb9e382835e418f2c6c926313b3c84605cf87a9e1 (diff)
downloadmeson-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.
Diffstat (limited to 'mesonbuild/wrap')
-rw-r--r--mesonbuild/wrap/wrap.py11
1 files changed, 7 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: