Merged revisions 85469 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85469 | antoine.pitrou | 2010-10-14 13:12:00 +0200 (jeu., 14 oct. 2010) | 3 lines

  Inherit interpreter flags in parallel testing
........
This commit is contained in:
Antoine Pitrou 2010-10-14 11:15:50 +00:00
parent 4b09b04b4d
commit a226c9100d
2 changed files with 22 additions and 5 deletions

View file

@ -1199,3 +1199,22 @@ def py3k_bytes(b):
return b"".join(chr(x) for x in b)
except TypeError:
return bytes(b)
def args_from_interpreter_flags():
"""Return a list of command-line arguments reproducing the current
settings in sys.flags."""
flag_opt_map = {
'bytes_warning': 'b',
'dont_write_bytecode': 'B',
'ignore_environment': 'E',
'no_user_site': 's',
'no_site': 'S',
'optimize': 'O',
'verbose': 'v',
}
args = []
for flag, opt in flag_opt_map.items():
v = getattr(sys.flags, flag)
if v > 0:
args.append('-' + opt * v)
return args