environment: Add a few type annotations

These are just annotations in code that I'm working for this series
pull/9193/head
Dylan Baker 3 years ago
parent 41c96d50af
commit 42eadd18d6
  1. 10
      mesonbuild/environment.py

@ -359,7 +359,7 @@ def detect_cpu_family(compilers: CompilersDict) -> str:
return trial
def detect_cpu(compilers: CompilersDict):
def detect_cpu(compilers: CompilersDict) -> str:
if mesonlib.is_windows():
trial = detect_windows_arch(compilers)
elif mesonlib.is_freebsd() or mesonlib.is_netbsd() or mesonlib.is_openbsd() or mesonlib.is_aix():
@ -392,15 +392,13 @@ def detect_cpu(compilers: CompilersDict):
# detect_cpu_family() above.
return trial
def detect_system():
def detect_system() -> str:
if sys.platform == 'cygwin':
return 'cygwin'
return platform.system().lower()
def detect_msys2_arch():
if 'MSYSTEM_CARCH' in os.environ:
return os.environ['MSYSTEM_CARCH']
return None
def detect_msys2_arch() -> T.Optional[str]:
return os.environ.get('MSYSTEM_CARCH', None)
def detect_machine_info(compilers: T.Optional[CompilersDict] = None) -> MachineInfo:
"""Detect the machine we're running on

Loading…
Cancel
Save