michael@0: import os, sys, subprocess michael@0: michael@0: def writetofile(args): michael@0: with open(args[0], 'w') as f: michael@0: f.write(' '.join(args[1:])) michael@0: michael@0: def writeenvtofile(args): michael@0: with open(args[0], 'w') as f: michael@0: f.write(os.environ[args[1]]) michael@0: michael@0: def writesubprocessenvtofile(args): michael@0: with open(args[0], 'w') as f: michael@0: p = subprocess.Popen([sys.executable, "-c", michael@0: "import os; print os.environ['%s']" % args[1]], michael@0: stdout=subprocess.PIPE, stderr=subprocess.PIPE) michael@0: stdout, stderr = p.communicate() michael@0: assert p.returncode == 0 michael@0: f.write(stdout) michael@0: michael@0: def convertasplode(arg): michael@0: try: michael@0: return int(arg) michael@0: except: michael@0: return (None if arg == "None" else arg) michael@0: michael@0: def asplode(args): michael@0: arg0 = convertasplode(args[0]) michael@0: sys.exit(arg0) michael@0: michael@0: def asplode_return(args): michael@0: arg0 = convertasplode(args[0]) michael@0: return arg0 michael@0: michael@0: def asplode_raise(args): michael@0: raise Exception(args[0]) michael@0: michael@0: def delayloadfn(args): michael@0: import delayload