all ndk paths in config must be strings

The paths in the config must be strings because they are used in things
like env vars where they must be strings.  Plus lots of other places in the
code assumes they are strings.  This is the first step to defining the
border of where paths can be pathlib.Path() and where they must be strings.
This commit is contained in:
Hans-Christoph Steiner 2023-03-27 15:54:43 +02:00
parent 898624dcac
commit 36d2a8f899
No known key found for this signature in database
GPG key ID: 3E177817BA1B9BFA
4 changed files with 45 additions and 2 deletions

View file

@ -325,12 +325,14 @@ class Build(dict):
return f
return 'ant'
def ndk_path(self):
"""Return the path to the first configured NDK or an empty string."""
def ndk_path(self) -> str:
"""Return the path string of the first configured NDK or an empty string."""
ndk = self.ndk
if isinstance(ndk, list):
ndk = self.ndk[0]
path = common.config['ndk_paths'].get(ndk)
if path and not isinstance(path, str):
raise TypeError('NDK path is not string')
if path:
return path
for vsn, path in common.config['ndk_paths'].items():