diff options
Diffstat (limited to 'mesonbuild/envconfig.py')
-rw-r--r-- | mesonbuild/envconfig.py | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py index 3e5e44b..8587842 100644 --- a/mesonbuild/envconfig.py +++ b/mesonbuild/envconfig.py @@ -317,11 +317,11 @@ class BinaryTable(HasEnvVarFallback): # Linkers 'c_ld': 'CC_LD', 'cpp_ld': 'CXX_LD', - 'd_ld': 'D_LD', - 'fortran_ld': 'F_LD', + 'd_ld': 'DC_LD', + 'fortran_ld': 'FC_LD', 'objc_ld': 'OBJC_LD', - 'objcpp_ld': 'OBJCPP_LD', - 'rust_ld': 'RUST_LD', + 'objcpp_ld': 'OBJCXX_LD', + 'rust_ld': 'RUSTC_LD', # Binutils 'strip': 'STRIP', @@ -334,6 +334,15 @@ class BinaryTable(HasEnvVarFallback): 'pkgconfig': 'PKG_CONFIG', } # 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: @@ -362,12 +371,10 @@ This is probably wrong, it should always point to the native compiler.''' % evar return compiler, ccache def lookup_entry(self, name: str) -> T.Optional[T.List[str]]: - """Lookup binaryk + """Lookup binary in cross/native file and fallback to environment. Returns command with args as list if found, Returns `None` if nothing is found. - - First tries looking in explicit map, then tries environment variable. """ # Try explicit map, don't fall back on env var command = self.binaries.get(name) @@ -380,9 +387,18 @@ This is probably wrong, it should always point to the native compiler.''' % evar # Relies on there being no "" env var evar = self.evarMap.get(name, "") command = os.environ.get(evar) + if command is None: + deprecated = self.DEPRECATION_MAP.get(evar) + if deprecated: + command = os.environ.get(deprecated) + if command: + mlog.deprecation( + 'The', deprecated, 'environment variable is deprecated in favor of', + evar, once=True) if command is not None: command = split_args(command) + # Do not return empty or blank string entries if command is not None and (len(command) == 0 or len(command[0].strip()) == 0): return None |