From f2ad5e377e0c70f4c7292f6abb33cbaa283d84b2 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 14 Jun 2021 15:36:16 -0700 Subject: backend: Headers.install_subdir is allowed to be None But we don't properly handle that. --- mesonbuild/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mesonbuild/build.py') diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 414a4f8..83dd3f0 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -149,7 +149,7 @@ class Headers(HoldableObject): def set_install_subdir(self, subdir: str) -> None: self.install_subdir = subdir - def get_install_subdir(self) -> str: + def get_install_subdir(self) -> T.Optional[str]: return self.install_subdir def get_sources(self) -> T.List[File]: -- cgit v1.1 From d636b92c1adc1588ff11b6ee4972c4bdd686f433 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 14 Jun 2021 15:36:17 -0700 Subject: install_*: FileMode doesn't need to be None There's no reason to allow None into the backend, it already has code to check that all of the values of the FileMode object are None, so let's use that, which is much simpler all the way down. --- mesonbuild/build.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'mesonbuild/build.py') diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 83dd3f0..ee3b9c9 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -135,7 +135,7 @@ class DependencyOverride(HoldableObject): class Headers(HoldableObject): def __init__(self, sources: T.List[File], install_subdir: T.Optional[str], - install_dir: T.Optional[str], install_mode: T.Optional['FileMode'], + install_dir: T.Optional[str], install_mode: 'FileMode', subproject: str): self.sources = sources self.install_subdir = install_subdir @@ -158,14 +158,14 @@ class Headers(HoldableObject): def get_custom_install_dir(self) -> T.Optional[str]: return self.custom_install_dir - def get_custom_install_mode(self) -> T.Optional['FileMode']: + def get_custom_install_mode(self) -> 'FileMode': return self.custom_install_mode class Man(HoldableObject): def __init__(self, sources: T.List[File], install_dir: T.Optional[str], - install_mode: T.Optional['FileMode'], subproject: str, + install_mode: 'FileMode', subproject: str, locale: T.Optional[str]): self.sources = sources self.custom_install_dir = install_dir @@ -176,7 +176,7 @@ class Man(HoldableObject): def get_custom_install_dir(self) -> T.Optional[str]: return self.custom_install_dir - def get_custom_install_mode(self) -> T.Optional['FileMode']: + def get_custom_install_mode(self) -> 'FileMode': return self.custom_install_mode def get_sources(self) -> T.List['File']: @@ -186,7 +186,7 @@ class Man(HoldableObject): class InstallDir(HoldableObject): def __init__(self, src_subdir: str, inst_subdir: str, install_dir: str, - install_mode: T.Optional['FileMode'], + install_mode: 'FileMode', exclude: T.Tuple[T.Set[str], T.Set[str]], strip_directory: bool, subproject: str, from_source_dir: bool = True): @@ -2611,7 +2611,7 @@ class ConfigurationData(HoldableObject): # during install. class Data(HoldableObject): def __init__(self, sources: T.List[File], install_dir: str, - install_mode: T.Optional['FileMode'], subproject: str, + install_mode: 'FileMode', subproject: str, rename: T.List[str] = None): self.sources = sources self.install_dir = install_dir -- cgit v1.1