build/pymake/tests/pycmd.py

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 import os, sys, subprocess
     3 def writetofile(args):
     4   with open(args[0], 'w') as f:
     5     f.write(' '.join(args[1:]))
     7 def writeenvtofile(args):
     8   with open(args[0], 'w') as f:
     9     f.write(os.environ[args[1]])
    11 def writesubprocessenvtofile(args):
    12   with open(args[0], 'w') as f:
    13     p = subprocess.Popen([sys.executable, "-c",
    14                           "import os; print os.environ['%s']" % args[1]],
    15                           stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    16     stdout, stderr = p.communicate()
    17     assert p.returncode == 0
    18     f.write(stdout)
    20 def convertasplode(arg):
    21   try:
    22     return int(arg)
    23   except:
    24     return (None if arg == "None" else arg)
    26 def asplode(args):
    27   arg0 = convertasplode(args[0])
    28   sys.exit(arg0)
    30 def asplode_return(args):
    31   arg0 = convertasplode(args[0])
    32   return arg0
    34 def asplode_raise(args):
    35   raise Exception(args[0])
    37 def delayloadfn(args):
    38     import delayload

mercurial