aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/envconfig.py
diff options
context:
space:
mode:
authorTristan Partin <tristan@partin.io>2021-01-20 21:46:55 -0600
committerDylan Baker <dylan@pnwbakers.com>2021-04-12 10:43:11 -0700
commit4c13aa30a1714b1fdbebb465f4621f332e241505 (patch)
treebf6d41521b02a024a8cd24cf10ef75e57d38a57d /mesonbuild/envconfig.py
parent50cf8bcabaa2a9b1ae37c071c7c5f4afd47af4d0 (diff)
downloadmeson-4c13aa30a1714b1fdbebb465f4621f332e241505.zip
meson-4c13aa30a1714b1fdbebb465f4621f332e241505.tar.gz
meson-4c13aa30a1714b1fdbebb465f4621f332e241505.tar.bz2
dependency: Add JDK system dependency
The JDK system dependency is important for detecting JDK include paths that may be useful when developing a JNI interface.
Diffstat (limited to 'mesonbuild/envconfig.py')
-rw-r--r--mesonbuild/envconfig.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py
index f2792c5..c6a4df3 100644
--- a/mesonbuild/envconfig.py
+++ b/mesonbuild/envconfig.py
@@ -136,9 +136,9 @@ class CMakeSkipCompilerTest(Enum):
class Properties:
def __init__(
self,
- properties: T.Optional[T.Dict[str, T.Union[str, bool, int, T.List[str]]]] = None,
+ properties: T.Optional[T.Dict[str, T.Optional[T.Union[str, bool, int, T.List[str]]]]] = None,
):
- self.properties = properties or {} # type: T.Dict[str, T.Union[str, bool, int, T.List[str]]]
+ self.properties = properties or {} # type: T.Dict[str, T.Optional[T.Union[str, bool, int, T.List[str]]]]
def has_stdlib(self, language: str) -> bool:
return language + '_stdlib' in self.properties
@@ -210,13 +210,17 @@ class Properties:
assert isinstance(res, bool)
return res
+ def get_java_home(self) -> T.Optional[Path]:
+ value = T.cast(T.Optional[str], self.properties.get('java_home'))
+ return Path(value) if value else None
+
def __eq__(self, other: object) -> bool:
if isinstance(other, type(self)):
return self.properties == other.properties
return NotImplemented
# TODO consider removing so Properties is less freeform
- def __getitem__(self, key: str) -> T.Union[str, bool, int, T.List[str]]:
+ def __getitem__(self, key: str) -> T.Optional[T.Union[str, bool, int, T.List[str]]]:
return self.properties[key]
# TODO consider removing so Properties is less freeform
@@ -224,7 +228,7 @@ class Properties:
return item in self.properties
# TODO consider removing, for same reasons as above
- def get(self, key: str, default: T.Union[str, bool, int, T.List[str]] = None) -> T.Union[str, bool, int, T.List[str]]:
+ def get(self, key: str, default: T.Optional[T.Union[str, bool, int, T.List[str]]] = None) -> T.Optional[T.Union[str, bool, int, T.List[str]]]:
return self.properties.get(key, default)
class MachineInfo: