aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/envconfig.py90
-rwxr-xr-xrun_unittests.py8
2 files changed, 49 insertions, 49 deletions
diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py
index db1041f..642aab3 100644
--- a/mesonbuild/envconfig.py
+++ b/mesonbuild/envconfig.py
@@ -85,6 +85,49 @@ CPU_FAMILES_64_BIT = [
'x86_64',
]
+# Map from language identifiers to environment variables.
+ENV_VAR_PROG_MAP: T.Mapping[str, str] = {
+ # Compilers
+ 'c': 'CC',
+ 'cpp': 'CXX',
+ 'cs': 'CSC',
+ 'd': 'DC',
+ 'fortran': 'FC',
+ 'objc': 'OBJC',
+ 'objcpp': 'OBJCXX',
+ 'rust': 'RUSTC',
+ 'vala': 'VALAC',
+
+ # Linkers
+ 'c_ld': 'CC_LD',
+ 'cpp_ld': 'CXX_LD',
+ 'd_ld': 'DC_LD',
+ 'fortran_ld': 'FC_LD',
+ 'objc_ld': 'OBJC_LD',
+ 'objcpp_ld': 'OBJCXX_LD',
+ 'rust_ld': 'RUSTC_LD',
+
+ # Binutils
+ 'strip': 'STRIP',
+ 'ar': 'AR',
+ 'windres': 'WINDRES',
+
+ # Other tools
+ 'cmake': 'CMAKE',
+ 'qmake': 'QMAKE',
+ 'pkgconfig': 'PKG_CONFIG',
+ 'make': 'MAKE',
+}
+
+# Deprecated environment variables mapped from the new variable to the old one
+# Deprecated in 0.54.0
+DEPRECATED_ENV_PROG_MAP: T.Mapping[str, str] = {
+ 'DC_LD': 'D_LD',
+ 'FC_LD': 'F_LD',
+ 'RUSTC_LD': 'RUST_LD',
+ 'OBJCXX_LD': 'OBJCPP_LD',
+}
+
class CMakeSkipCompilerTest(Enum):
ALWAYS = 'always'
NEVER = 'never'
@@ -363,49 +406,6 @@ class BinaryTable:
'Invalid type {!r} for binary {!r} in cross file'
''.format(command, name))
- # Map from language identifiers to environment variables.
- evarMap = {
- # Compilers
- 'c': 'CC',
- 'cpp': 'CXX',
- 'cs': 'CSC',
- 'd': 'DC',
- 'fortran': 'FC',
- 'objc': 'OBJC',
- 'objcpp': 'OBJCXX',
- 'rust': 'RUSTC',
- 'vala': 'VALAC',
-
- # Linkers
- 'c_ld': 'CC_LD',
- 'cpp_ld': 'CXX_LD',
- 'd_ld': 'DC_LD',
- 'fortran_ld': 'FC_LD',
- 'objc_ld': 'OBJC_LD',
- 'objcpp_ld': 'OBJCXX_LD',
- 'rust_ld': 'RUSTC_LD',
-
- # Binutils
- 'strip': 'STRIP',
- 'ar': 'AR',
- 'windres': 'WINDRES',
-
- # Other tools
- 'cmake': 'CMAKE',
- 'qmake': 'QMAKE',
- 'pkgconfig': 'PKG_CONFIG',
- 'make': 'MAKE',
- } # type: T.Dict[str, str]
-
- # Deprecated environment variables mapped from the new variable to the old one
- # Deprecated in 0.54.0
- DEPRECATION_MAP = {
- 'DC_LD': 'D_LD',
- 'FC_LD': 'F_LD',
- 'RUSTC_LD': 'RUST_LD',
- 'OBJCXX_LD': 'OBJCPP_LD',
- } # type: T.Dict[str, str]
-
@staticmethod
def detect_ccache() -> T.List[str]:
try:
@@ -442,11 +442,11 @@ class BinaryTable:
if raw_command is not None:
command = mesonlib.stringlistify(raw_command)
break # found
- evar = self.evarMap.get(name)
+ evar = ENV_VAR_PROG_MAP.get(name)
if evar is not None:
raw_command = get_env_var(for_machine, is_cross, evar)
if raw_command is None:
- deprecated = self.DEPRECATION_MAP.get(evar)
+ deprecated = DEPRECATED_ENV_PROG_MAP.get(evar)
if deprecated is not None:
raw_command = get_env_var(for_machine, is_cross, deprecated)
if raw_command is not None:
diff --git a/run_unittests.py b/run_unittests.py
index 2f102b4..cf78e3e 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -5689,12 +5689,12 @@ class WindowsTests(BasePlatformTests):
def _check_ld(self, name: str, lang: str, expected: str) -> None:
if not shutil.which(name):
raise unittest.SkipTest('Could not find {}.'.format(name))
- envvars = [mesonbuild.envconfig.BinaryTable.evarMap['{}_ld'.format(lang)]]
+ envvars = [mesonbuild.envconfig.ENV_VAR_PROG_MAP['{}_ld'.format(lang)]]
# Also test a deprecated variable if there is one.
- if envvars[0] in mesonbuild.envconfig.BinaryTable.DEPRECATION_MAP:
+ if envvars[0] in mesonbuild.envconfig.DEPRECATED_ENV_PROG_MAP:
envvars.append(
- mesonbuild.envconfig.BinaryTable.DEPRECATION_MAP[envvars[0]])
+ mesonbuild.envconfig.DEPRECATED_ENV_PROG_MAP[envvars[0]])
for envvar in envvars:
with mock.patch.dict(os.environ, {envvar: name}):
@@ -7293,7 +7293,7 @@ class LinuxlikeTests(BasePlatformTests):
raise unittest.SkipTest('Solaris currently cannot override the linker.')
if not shutil.which(check):
raise unittest.SkipTest('Could not find {}.'.format(check))
- envvars = [mesonbuild.envconfig.BinaryTable.evarMap['{}_ld'.format(lang)]]
+ envvars = [mesonbuild.envconfig.BinaryTable.ENV_VAR_PROG_MAP['{}_ld'.format(lang)]]
# Also test a deprecated variable if there is one.
if envvars[0] in mesonbuild.envconfig.BinaryTable.DEPRECATION_MAP: