aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/wrap/wrap.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2019-05-28 16:56:45 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2019-06-06 18:27:05 +0200
commite02c1015750fb9a5a15a9d0930281cd78e012133 (patch)
treed67c8b2923e7b1eba19ea0d871496a355ee2a915 /mesonbuild/wrap/wrap.py
parentaf6448ced5955f8fb43aa667ce8065d50c104fba (diff)
downloadmeson-e02c1015750fb9a5a15a9d0930281cd78e012133.zip
meson-e02c1015750fb9a5a15a9d0930281cd78e012133.tar.gz
meson-e02c1015750fb9a5a15a9d0930281cd78e012133.tar.bz2
cmake: moved subprojects into the CMake module
Diffstat (limited to 'mesonbuild/wrap/wrap.py')
-rw-r--r--mesonbuild/wrap/wrap.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py
index 47db985..55f86bc 100644
--- a/mesonbuild/wrap/wrap.py
+++ b/mesonbuild/wrap/wrap.py
@@ -111,7 +111,7 @@ class Resolver:
self.subdir_root = subdir_root
self.cachedir = os.path.join(self.subdir_root, 'packagecache')
- def resolve(self, packagename):
+ def resolve(self, packagename: str, method: str):
self.packagename = packagename
self.directory = packagename
# We always have to load the wrap file, if it exists, because it could
@@ -125,8 +125,13 @@ class Resolver:
meson_file = os.path.join(self.dirname, 'meson.build')
cmake_file = os.path.join(self.dirname, 'CMakeLists.txt')
+ if method not in ['meson', 'cmake']:
+ raise WrapException('Only the methods "meson" and "cmake" are supported')
+
# The directory is there and has meson.build? Great, use it.
- if os.path.exists(meson_file) or os.path.exists(cmake_file):
+ if method == 'meson' and os.path.exists(meson_file):
+ return self.directory
+ if method == 'cmake' and os.path.exists(cmake_file):
return self.directory
# Check if the subproject is a git submodule
@@ -154,9 +159,11 @@ class Resolver:
else:
raise WrapException('Unknown wrap type {!r}'.format(self.wrap.type))
- # A meson.build file is required in the directory
- if not os.path.exists(meson_file):
+ # A meson.build or CMakeLists.txt file is required in the directory
+ if method == 'meson' and not os.path.exists(meson_file):
raise WrapException('Subproject exists but has no meson.build file')
+ if method == 'cmake' and not os.path.exists(cmake_file):
+ raise WrapException('Subproject exists but has no CMakeLists.txt file')
return self.directory