wrap: Small simplification

pull/10864/head
Xavier Claessens 2 years ago committed by Eli Schwartz
parent b314d1f7c1
commit b9e382835e
  1. 19
      mesonbuild/wrap/wrap.py

@ -368,18 +368,17 @@ class Resolver:
self.dirname = self.wrap.filename
rel_path = os.path.relpath(self.dirname, self.source_dir)
meson_file = os.path.join(self.dirname, 'meson.build')
cmake_file = os.path.join(self.dirname, 'CMakeLists.txt')
if method not in ['meson', 'cmake']:
if method == 'meson':
buildfile = os.path.join(self.dirname, 'meson.build')
elif method == 'cmake':
buildfile = os.path.join(self.dirname, 'CMakeLists.txt')
else:
raise WrapException('Only the methods "meson" and "cmake" are supported')
# The directory is there and has meson.build? Great, use it.
if method == 'meson' and os.path.exists(meson_file):
if os.path.exists(buildfile):
self.validate()
return rel_path
if method == 'cmake' and os.path.exists(cmake_file):
return rel_path
# Check if the subproject is a git submodule
self.resolve_git_submodule()
@ -408,10 +407,8 @@ class Resolver:
raise
# 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')
if not os.path.exists(buildfile):
raise WrapException(f'Subproject exists but has no {os.path.basename(buildfile)} file')
# At this point, the subproject has been successfully resolved for the
# first time so save off the hash of the entire wrap file for future

Loading…
Cancel
Save