diff options
Diffstat (limited to 'mesonbuild/utils/universal.py')
-rw-r--r-- | mesonbuild/utils/universal.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mesonbuild/utils/universal.py b/mesonbuild/utils/universal.py index 570edd6..b1a301a 100644 --- a/mesonbuild/utils/universal.py +++ b/mesonbuild/utils/universal.py @@ -2289,16 +2289,21 @@ def pickle_load(filename: str, object_name: str, object_type: T.Type) -> T.Any: except (pickle.UnpicklingError, EOFError): raise MesonException(load_fail_msg) except (TypeError, ModuleNotFoundError, AttributeError): + build_dir = os.path.dirname(os.path.dirname(filename)) raise MesonException( f"{object_name} file {filename!r} references functions or classes that don't " "exist. This probably means that it was generated with an old " - "version of meson.") + "version of meson. Try running from the source directory " + f'meson setup {build_dir} --wipe') if not isinstance(obj, object_type): raise MesonException(load_fail_msg) from ..coredata import version as coredata_version from ..coredata import major_versions_differ, MesonVersionMismatchException - if major_versions_differ(obj.version, coredata_version): - raise MesonVersionMismatchException(obj.version, coredata_version) + version = getattr(obj, 'version', None) + if version is None: + version = obj.environment.coredata.version + if major_versions_differ(version, coredata_version): + raise MesonVersionMismatchException(version, coredata_version) return obj |