diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-07-27 15:26:02 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-09-24 10:36:05 -0700 |
commit | d661a0cd96e2453e8e4629c867589657b81239d1 (patch) | |
tree | dfe6acbb7a20b0f2a43e334470a311aa8f754122 /mesonbuild/build.py | |
parent | 6c5bfd4c241e94f5e0f4dea9ba7fb5d5090a4802 (diff) | |
download | meson-d661a0cd96e2453e8e4629c867589657b81239d1.zip meson-d661a0cd96e2453e8e4629c867589657b81239d1.tar.gz meson-d661a0cd96e2453e8e4629c867589657b81239d1.tar.bz2 |
build: use an object rather than a dict for the dep_manifest
This really is more of a struct than a dict, as the types are disjoint
and they are internally handled, (ie, not from user input). This cleans
some things up, in addition I spotted a bug in the ModuleState where the
dict with the version and license is passed to a field that expects just
the version string.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r-- | mesonbuild/build.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index ed3fc07..464b096 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -206,6 +206,19 @@ class InstallDir(HoldableObject): self.install_tag = install_tag +class DepManifest: + + def __init__(self, version: str, license: T.List[str]): + self.version = version + self.license = license + + def to_json(self) -> T.Dict[str, T.Union[str, T.List[str]]]: + return { + 'version': self.version, + 'license': self.license, + } + + class Build: """A class that holds the status of one build including all dependencies and so on. @@ -235,7 +248,7 @@ class Build: self.dist_scripts: T.List['ExecutableSerialisation'] = [] self.install_dirs: T.List[InstallDir] = [] self.dep_manifest_name: T.Optional[str] = None - self.dep_manifest: T.Dict[str, T.Dict[str, T.Any]] = {} # TODO: what should this dict be? + self.dep_manifest: T.Dict[str, DepManifest] = {} self.stdlibs = PerMachine({}, {}) self.test_setups: T.Dict[str, TestSetup] = {} self.test_setup_default_name = None |