diff options
| author | Rafael Silva <perigoso@riseup.net> | 2023-07-07 04:09:49 +0100 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2023-07-10 17:52:42 +0300 |
| commit | 339b248abc0170986af1afb1b1478b4bd179bb13 (patch) | |
| tree | ac45506f17d10aac4f3a3c900e9825a01e99a729 | |
| parent | 6cb7ef1f3b780bd11730d5779485073217d09d88 (diff) | |
| download | meson-339b248abc0170986af1afb1b1478b4bd179bb13.tar.gz | |
parse meson.build for subproject_dir in msubprojects
we parse project from source meson.build with IntrospectionInterpreter
| -rwxr-xr-x | mesonbuild/msubprojects.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mesonbuild/msubprojects.py b/mesonbuild/msubprojects.py index 622f1a53e..3ecfba18f 100755 --- a/mesonbuild/msubprojects.py +++ b/mesonbuild/msubprojects.py @@ -14,6 +14,7 @@ import tarfile import zipfile from . import mlog +from .ast import IntrospectionInterpreter, AstIDGenerator from .mesonlib import quiet_git, GitException, Popen_safe, MesonException, windows_proof_rmtree from .wrap.wrap import (Resolver, WrapException, ALL_TYPES, PackageDefinition, parse_patch_url, update_wrap_file, get_releases) @@ -689,10 +690,16 @@ def run(options: 'Arguments') -> int: if not os.path.isfile(os.path.join(source_dir, 'meson.build')): mlog.error('Directory', mlog.bold(source_dir), 'does not seem to be a Meson source directory.') return 1 - if not os.path.isdir(os.path.join(source_dir, 'subprojects')): + with mlog.no_logging(): + intr = IntrospectionInterpreter(source_dir, '', 'none', visitors = [AstIDGenerator()]) + intr.load_root_meson_file() + intr.sanity_check_ast() + intr.parse_project() + subproject_dir = intr.subproject_dir + if not os.path.isdir(os.path.join(source_dir, subproject_dir)): mlog.log('Directory', mlog.bold(source_dir), 'does not seem to have subprojects.') return 0 - r = Resolver(source_dir, 'subprojects', wrap_frontend=True, allow_insecure=options.allow_insecure, silent=True) + r = Resolver(source_dir, subproject_dir, wrap_frontend=True, allow_insecure=options.allow_insecure, silent=True) if options.subprojects: wraps = [wrap for name, wrap in r.wraps.items() if name in options.subprojects] else: @@ -713,7 +720,7 @@ def run(options: 'Arguments') -> int: pre_func(options) logger = Logger(len(wraps)) for wrap in wraps: - dirname = Path(subprojects_dir, wrap.directory).as_posix() + dirname = Path(subproject_dir, wrap.directory).as_posix() runner = Runner(logger, r, wrap, dirname, options) task = loop.run_in_executor(executor, runner.run) tasks.append(task) |
