diff options
Diffstat (limited to 'SCons/Platform')
-rw-r--r-- | SCons/Platform/PlatformTests.py | 18 | ||||
-rw-r--r-- | SCons/Platform/__init__.py | 8 | ||||
-rw-r--r-- | SCons/Platform/aix.py | 2 | ||||
-rw-r--r-- | SCons/Platform/cygwin.py | 2 | ||||
-rw-r--r-- | SCons/Platform/darwin.py | 2 | ||||
-rw-r--r-- | SCons/Platform/hpux.py | 2 | ||||
-rw-r--r-- | SCons/Platform/irix.py | 2 | ||||
-rw-r--r-- | SCons/Platform/os2.py | 2 | ||||
-rw-r--r-- | SCons/Platform/posix.py | 2 | ||||
-rw-r--r-- | SCons/Platform/sunos.py | 2 | ||||
-rw-r--r-- | SCons/Platform/virtualenv.py | 8 | ||||
-rw-r--r-- | SCons/Platform/virtualenvTests.py | 36 | ||||
-rw-r--r-- | SCons/Platform/win32.py | 4 |
13 files changed, 45 insertions, 45 deletions
diff --git a/SCons/Platform/PlatformTests.py b/SCons/Platform/PlatformTests.py index ee0ab75a6..852c76371 100644 --- a/SCons/Platform/PlatformTests.py +++ b/SCons/Platform/PlatformTests.py @@ -36,12 +36,12 @@ class Environment(collections.UserDict): def Detect(self, cmd): return cmd - def AppendENVPath(self, key, value): + def AppendENVPath(self, key, value) -> None: pass class PlatformTestCase(unittest.TestCase): - def test_Platform(self): + def test_Platform(self) -> None: """Test the Platform() function""" p = SCons.Platform.Platform('cygwin') assert str(p) == 'cygwin', p @@ -132,7 +132,7 @@ class PlatformTestCase(unittest.TestCase): SCons.Platform.Platform()(env) assert env != {}, env - def test_win32_no_arch_shell_variables(self): + def test_win32_no_arch_shell_variables(self) -> None: """ Test that a usable HOST_ARCH is available when neither: PROCESSOR_ARCHITEW6432 nor PROCESSOR_ARCHITECTURE @@ -160,7 +160,7 @@ class PlatformTestCase(unittest.TestCase): class TempFileMungeTestCase(unittest.TestCase): - def test_MAXLINELENGTH(self): + def test_MAXLINELENGTH(self) -> None: """ Test different values for MAXLINELENGTH with the same size command string to ensure that the temp file mechanism kicks in only at MAXLINELENGTH+1, or higher @@ -196,7 +196,7 @@ class TempFileMungeTestCase(unittest.TestCase): SCons.Action.print_actions = old_actions assert cmd != defined_cmd, cmd - def test_TEMPFILEARGJOINBYTE(self): + def test_TEMPFILEARGJOINBYTE(self) -> None: """ Test argument join byte TEMPFILEARGJOINBYTE """ @@ -231,7 +231,7 @@ class TempFileMungeTestCase(unittest.TestCase): SCons.Action.print_actions = old_actions assert file_content != env['TEMPFILEARGJOINBYTE'].join(['test','command','line']) - def test_TEMPFILEARGESCFUNC(self): + def test_TEMPFILEARGESCFUNC(self) -> None: """ Test a custom TEMPFILEARGESCFUNC """ @@ -261,7 +261,7 @@ class TempFileMungeTestCase(unittest.TestCase): SCons.Action.print_actions = old_actions assert b"newarg" in file_content - def test_tempfilecreation_once(self): + def test_tempfilecreation_once(self) -> None: """ Init class with cmd, such that the fully expanded string reads "a test command line". @@ -287,7 +287,7 @@ class TempFileMungeTestCase(unittest.TestCase): class Attrs: pass - def __init__(self): + def __init__(self) -> None: self.attributes = self.Attrs() target = [Node()] @@ -300,7 +300,7 @@ class TempFileMungeTestCase(unittest.TestCase): class PlatformEscapeTestCase(unittest.TestCase): - def test_posix_escape(self): + def test_posix_escape(self) -> None: """ Check that paths with parens are escaped properly """ import SCons.Platform.posix diff --git a/SCons/Platform/__init__.py b/SCons/Platform/__init__.py index 3fa5a75e2..77eea5c09 100644 --- a/SCons/Platform/__init__.py +++ b/SCons/Platform/__init__.py @@ -130,14 +130,14 @@ def DefaultToolList(platform, env): class PlatformSpec: - def __init__(self, name, generate): + def __init__(self, name, generate) -> None: self.name = name self.generate = generate def __call__(self, *args, **kw): return self.generate(*args, **kw) - def __str__(self): + def __str__(self) -> str: return self.name @@ -192,7 +192,7 @@ class TempFileMunge: env["TEMPFILEARGESCFUNC"] = tempfile_arg_esc_func """ - def __init__(self, cmd, cmdstr = None): + def __init__(self, cmd, cmdstr = None) -> None: self.cmd = cmd self.cmdstr = cmdstr @@ -323,7 +323,7 @@ class TempFileMunge: return cmdlist - def _print_cmd_str(self, target, source, env, cmdstr): + def _print_cmd_str(self, target, source, env, cmdstr) -> None: # check if the user has specified a cmd line print function print_func = None try: diff --git a/SCons/Platform/aix.py b/SCons/Platform/aix.py index e5f34b45f..3afe50638 100644 --- a/SCons/Platform/aix.py +++ b/SCons/Platform/aix.py @@ -67,7 +67,7 @@ def get_xlc(env, xlc=None, packages=[]): xlcPath, sep, xlc = filename.rpartition('/') return (xlcPath, xlc, xlcVersion) -def generate(env): +def generate(env) -> None: posix.generate(env) #Based on AIX 5.2: ARG_MAX=24576 - 3000 for environment expansion env['MAXLINELENGTH'] = 21576 diff --git a/SCons/Platform/cygwin.py b/SCons/Platform/cygwin.py index 82e1d616b..c62a668b3 100644 --- a/SCons/Platform/cygwin.py +++ b/SCons/Platform/cygwin.py @@ -40,7 +40,7 @@ if sys.platform == 'win32': r'C:\cygwin\bin' ] -def generate(env): +def generate(env) -> None: posix.generate(env) env['PROGPREFIX'] = '' diff --git a/SCons/Platform/darwin.py b/SCons/Platform/darwin.py index dcaf5c80f..f17968b62 100644 --- a/SCons/Platform/darwin.py +++ b/SCons/Platform/darwin.py @@ -32,7 +32,7 @@ from . import posix import os -def generate(env): +def generate(env) -> None: posix.generate(env) env['SHLIBSUFFIX'] = '.dylib' env['HOST_OS'] = 'darwin' diff --git a/SCons/Platform/hpux.py b/SCons/Platform/hpux.py index 642f1feff..9d796db39 100644 --- a/SCons/Platform/hpux.py +++ b/SCons/Platform/hpux.py @@ -30,7 +30,7 @@ selection method. from . import posix -def generate(env): +def generate(env) -> None: posix.generate(env) #Based on HP-UX11i: ARG_MAX=2048000 - 3000 for environment expansion env['MAXLINELENGTH'] = 2045000 diff --git a/SCons/Platform/irix.py b/SCons/Platform/irix.py index 4d6be540d..19f619b13 100644 --- a/SCons/Platform/irix.py +++ b/SCons/Platform/irix.py @@ -30,7 +30,7 @@ selection method. from . import posix -def generate(env): +def generate(env) -> None: posix.generate(env) env['HOST_OS'] = 'irix' diff --git a/SCons/Platform/os2.py b/SCons/Platform/os2.py index 6b412eed2..7394aa899 100644 --- a/SCons/Platform/os2.py +++ b/SCons/Platform/os2.py @@ -30,7 +30,7 @@ selection method. from . import win32 -def generate(env): +def generate(env) -> None: if 'ENV' not in env: env['ENV'] = {} env['OBJPREFIX'] = '' diff --git a/SCons/Platform/posix.py b/SCons/Platform/posix.py index 75b6c0bf2..55b00b4db 100644 --- a/SCons/Platform/posix.py +++ b/SCons/Platform/posix.py @@ -74,7 +74,7 @@ def piped_env_spawn(sh, escape, cmd, args, env, stdout, stderr): env, stdout, stderr) -def generate(env): +def generate(env) -> None: # Bearing in mind we have python 2.4 as a baseline, we can just do this: spawn = subprocess_spawn pspawn = piped_env_spawn diff --git a/SCons/Platform/sunos.py b/SCons/Platform/sunos.py index 86924335f..4aa1fffcb 100644 --- a/SCons/Platform/sunos.py +++ b/SCons/Platform/sunos.py @@ -30,7 +30,7 @@ selection method. from . import posix -def generate(env): +def generate(env) -> None: posix.generate(env) # Based on sunSparc 8:32bit # ARG_MAX=1048320 - 3000 for environment expansion diff --git a/SCons/Platform/virtualenv.py b/SCons/Platform/virtualenv.py index 2204a595b..df7ad574d 100644 --- a/SCons/Platform/virtualenv.py +++ b/SCons/Platform/virtualenv.py @@ -51,7 +51,7 @@ def _running_in_virtualenv(): (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix)) -def _is_path_in(path, base): +def _is_path_in(path, base) -> bool: """Returns true if **path** is located under the **base** directory.""" if not path or not base: # empty path may happen, base too return False @@ -59,7 +59,7 @@ def _is_path_in(path, base): return (not rp.startswith(os.path.pardir)) and (not rp == os.path.curdir) -def _inject_venv_variables(env): +def _inject_venv_variables(env) -> None: if 'ENV' not in env: env['ENV'] = {} ENV = env['ENV'] @@ -69,7 +69,7 @@ def _inject_venv_variables(env): except KeyError: pass -def _inject_venv_path(env, path_list=None): +def _inject_venv_path(env, path_list=None) -> None: """Modify environment such that SCons will take into account its virtualenv when running external tools.""" if path_list is None: @@ -86,7 +86,7 @@ def select_paths_in_venv(path_list): return [path for path in path_list if IsInVirtualenv(path)] -def ImportVirtualenv(env): +def ImportVirtualenv(env) -> None: """Copies virtualenv-related environment variables from OS environment to ``env['ENV']`` and prepends virtualenv's PATH to ``env['ENV']['PATH']``. """ diff --git a/SCons/Platform/virtualenvTests.py b/SCons/Platform/virtualenvTests.py index c840749df..9591063ae 100644 --- a/SCons/Platform/virtualenvTests.py +++ b/SCons/Platform/virtualenvTests.py @@ -34,7 +34,7 @@ class Environment(collections.UserDict): def Detect(self, cmd): return cmd - def AppendENVPath(self, key, value): + def AppendENVPath(self, key, value) -> None: if SCons.Util.is_List(value): value = os.path.pathsep.join(value) if 'ENV' not in self: @@ -45,7 +45,7 @@ class Environment(collections.UserDict): else: self['ENV'][key] = os.path.pathsep.join([current, value]) - def PrependENVPath(self, key, value): + def PrependENVPath(self, key, value) -> None: if SCons.Util.is_List(value): value = os.path.pathsep.join(value) if 'ENV' not in self: @@ -58,12 +58,12 @@ class Environment(collections.UserDict): class SysPrefixes: """Used to temporarily mock sys.prefix, sys.real_prefix and sys.base_prefix""" - def __init__(self, prefix, real_prefix=None, base_prefix=None): + def __init__(self, prefix, real_prefix=None, base_prefix=None) -> None: self._prefix = prefix self._real_prefix = real_prefix self._base_prefix = base_prefix - def start(self): + def start(self) -> None: self._store() sys.prefix = self._prefix if self._real_prefix is None: @@ -77,7 +77,7 @@ class SysPrefixes: else: sys.base_prefix = self._base_prefix - def stop(self): + def stop(self) -> None: self._restore() def __enter__(self): @@ -85,10 +85,10 @@ class SysPrefixes: attrs = ('prefix', 'real_prefix', 'base_prefix') return {k: getattr(sys, k) for k in attrs if hasattr(sys, k)} - def __exit__(self, *args): + def __exit__(self, *args) -> None: self.stop() - def _store(self): + def _store(self) -> None: s = dict() if hasattr(sys, 'real_prefix'): s['real_prefix'] = sys.real_prefix @@ -97,7 +97,7 @@ class SysPrefixes: s['prefix'] = sys.prefix self._stored = s - def _restore(self): + def _restore(self) -> None: s = self._stored if 'real_prefix' in s: sys.real_prefix = s['real_prefix'] @@ -117,7 +117,7 @@ def _p(p): class _is_path_in_TestCase(unittest.TestCase): - def test_false(self): + def test_false(self) -> None: for args in [ ('',''), ('', _p('/foo/bar')), (_p('/foo/bar'), ''), @@ -127,7 +127,7 @@ class _is_path_in_TestCase(unittest.TestCase): (_p('foo'), _p('foo/bar')) ]: assert SCons.Platform.virtualenv._is_path_in(*args) is False, "_is_path_in(%r, %r) should be False" % args - def test__true(self): + def test__true(self) -> None: for args in [ (_p('/foo'), _p('/')), (_p('/foo/bar'), _p('/foo')), (_p('/foo/bar/geez'), _p('/foo/bar')), @@ -137,7 +137,7 @@ class _is_path_in_TestCase(unittest.TestCase): assert SCons.Platform.virtualenv._is_path_in(*args) is True, "_is_path_in(%r, %r) should be True" % args class IsInVirtualenvTestCase(unittest.TestCase): - def test_false(self): + def test_false(self) -> None: # "without wirtualenv" - always false with SysPrefixes(_p('/prefix')): for p in [ _p(''), @@ -166,7 +166,7 @@ class IsInVirtualenvTestCase(unittest.TestCase): _p('/virtualenv/bleah') ]: assert SCons.Platform.virtualenv.IsInVirtualenv(p) is False, "IsInVirtualenv(%r) should be False" % p - def test_true(self): + def test_true(self) -> None: # "with virtualenv" with SysPrefixes(_p('/virtualenv/prefix'), real_prefix=_p('/real/prefix')): for p in [ _p('/virtualenv/prefix/foo'), @@ -189,22 +189,22 @@ class _inject_venv_pathTestCase(unittest.TestCase): _p('/usr/bin'), _p('/opt/bin') ] - def test_with_path_string(self): + def test_with_path_string(self) -> None: env = Environment() path_string = os.path.pathsep.join(self.path_list()) with SysPrefixes(_p('/virtualenv/prefix'), real_prefix=_p('/real/prefix')): SCons.Platform.virtualenv._inject_venv_path(env, path_string) assert env['ENV']['PATH'] == _p('/virtualenv/prefix/bin'), env['ENV']['PATH'] - def test_with_path_list(self): + def test_with_path_list(self) -> None: env = Environment() with SysPrefixes(_p('/virtualenv/prefix'), real_prefix=_p('/real/prefix')): SCons.Platform.virtualenv._inject_venv_path(env, self.path_list()) assert env['ENV']['PATH'] == _p('/virtualenv/prefix/bin'), env['ENV']['PATH'] class VirtualenvTestCase(unittest.TestCase): - def test_none(self): - def _msg(given): + def test_none(self) -> None: + def _msg(given) -> str: return "Virtualenv() should be None, not %s" % repr(given) with SysPrefixes(_p('/prefix')): @@ -214,8 +214,8 @@ class VirtualenvTestCase(unittest.TestCase): ve = SCons.Platform.virtualenv.Virtualenv() assert ve is None, _msg(ve) - def test_not_none(self): - def _msg(expected, given): + def test_not_none(self) -> None: + def _msg(expected, given) -> str: return "Virtualenv() should == %r, not %s" % (_p(expected), repr(given)) with SysPrefixes(_p('/virtualenv/prefix'), real_prefix=_p('/real/prefix')): diff --git a/SCons/Platform/win32.py b/SCons/Platform/win32.py index 990794f96..c9fcd9502 100644 --- a/SCons/Platform/win32.py +++ b/SCons/Platform/win32.py @@ -58,7 +58,7 @@ if False: shutil.copy2 = CopyFile - def win_api_copyfile(src,dst): + def win_api_copyfile(src,dst) -> None: CopyFile(src,dst) os.utime(dst) @@ -283,7 +283,7 @@ class ArchDefinition: Determine which windows CPU were running on. A class for defining architecture-specific settings and logic. """ - def __init__(self, arch, synonyms=[]): + def __init__(self, arch, synonyms=[]) -> None: self.arch = arch self.synonyms = synonyms |