diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-01-12 09:59:56 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-01-13 19:01:38 +0100 |
commit | 243eca6cee9c84fec96c030c3465ecb85a3f4323 (patch) | |
tree | 3291aaae16619ef7fbd9a98983fd11067a278c5c | |
parent | 95c1cdf7767d5b5bf4614651afeafa100f1de45c (diff) | |
download | meson-243eca6cee9c84fec96c030c3465ecb85a3f4323.zip meson-243eca6cee9c84fec96c030c3465ecb85a3f4323.tar.gz meson-243eca6cee9c84fec96c030c3465ecb85a3f4323.tar.bz2 |
mintro: Check meson-info.json version instead of loading coredata
-rw-r--r-- | mesonbuild/mintro.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 829a05f..c6a08bf 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -39,6 +39,9 @@ def get_meson_info_file(info_dir: str): def get_meson_introspection_version(): return '1.0.0' +def get_meson_introspection_required_version(): + return ['>=1.0', '<2.0'] + def get_meson_introspection_types(coredata: cdata.CoreData = None, builddata: build.Build = None, backend: backends.Backend = None): if backend and builddata: benchmarkdata = backend.create_test_serialisation(builddata.get_benchmarks()) @@ -503,16 +506,26 @@ def run(options): if options.buildoptions: list_buildoptions_from_source(sourcedir, options.backend, indent) return 0 - if not os.path.isdir(datadir) or not os.path.isdir(infodir): + infofile = get_meson_info_file(infodir) + if not os.path.isdir(datadir) or not os.path.isdir(infodir) or not os.path.isfile(infofile): print('Current directory is not a meson build directory.' 'Please specify a valid build dir or change the working directory to it.' 'It is also possible that the build directory was generated with an old' 'meson version. Please regenerate it in this case.') return 1 - # Load build data to make sure that the version matches - # TODO Find a better solution for this - cdata.load(options.builddir) + intro_vers = '0.0.0' + with open(infofile, 'r') as fp: + raw = json.load(fp) + intro_vers = raw.get('introspection', {}).get('version', {}).get('full', '0.0.0') + + vers_to_check = get_meson_introspection_required_version() + for i in vers_to_check: + if not mesonlib.version_compare(intro_vers, i): + print('Introspection version {} is not supported. ' + 'The required version is: {}' + .format(intro_vers, ' and '.join(vers_to_check))) + return 1 results = [] toextract = [] |