(for_machine: MachineChoice, is_cross: bool, var_name: str)
return value
Returns the exact env var and the value.
Returns the exact env var and the value.
Returns the exact env var and the value .
def _get_env_var(for_machine: MachineChoice, is_cross: bool, var_name: str) -> T.Optional[str]:
    """
    Returns the exact env var and the value.
    """
    candidates = PerMachine(
        # The prefixed build version takes priority, but if we are native
        # compiling we fall back on the unprefixed host version. This
        # allows native builds to never need to worry about the 'BUILD_*'
        # ones.
        ([var_name + '_FOR_BUILD'] if is_cross else [var_name]),
        # Always just the unprefixed host versions
        [var_name]
    )[for_machine]
    for var in candidates:
        value = os.environ.get(var)
        if value is not None:
            break
    else:
        formatted = ', '.join([f'{var!r}' for var in candidates])
        mlog.debug(f'None of {formatted} are defined in the environment, not changing global flags.')
        return None
    mlog.debug(f'Using {var!r} from environment with value: {value!r}')
    return value
def _get_env_var ( for_machine : MachineChoice , is_cross : bool , var_name : str ) -> T . Optional [ str ] : candidates = PerMachine ( # The prefixed build version takes priority, but if we are native # compiling we fall back on the unprefixed host version. This # allows native builds to never need to worry about the 'BUILD_*' # ones. ( [ var_name + '_FOR_BUILD' ] if is_cross else [ var_name ] ) , # Always just the unprefixed host versions [ var_name ] ) [ for_machine ] for var in candidates : value = os . environ . get ( var ) if value is not None : break else : formatted = ', ' . join ( [ f'{var!r}' for var in candidates ] ) mlog . debug ( f'None of {formatted} are defined in the environment, not changing global flags.' ) return None mlog . debug ( f'Using {var!r} from environment with value: {value!r}' ) return value