+ import re
+ from ctypes import WINFUNCTYPE, POINTER, byref, c_wchar_p, c_int, windll
+
+ GetCommandLineW = WINFUNCTYPE(c_wchar_p)(("GetCommandLineW", windll.kernel32))
+ CommandLineToArgvW = WINFUNCTYPE(POINTER(c_wchar_p), c_wchar_p, POINTER(c_int)) \
+ (("CommandLineToArgvW", windll.shell32))
+
+ argc = c_int(0)
+ argv_unicode = CommandLineToArgvW(GetCommandLineW(), byref(argc))
+
+ # See src/allmydata/scripts/runner.py for the corresponding unmangler.
+ # Note that this doesn't escape \x7F. If it did, test_unicode_arguments_and_output
+ # in test_runner.py wouldn't work.
+ def mangle(s):
+ return str(re.sub(ur'[^\x20-\x7F]', lambda m: u'\x7F%x;' % (ord(m.group(0)),), s))
+
+ argv = [mangle(argv_unicode[i]) for i in xrange(1, argc.value)]
+ local_tahoe = "Scripts\\tahoe.pyscript"
+else:
+ argv = sys.argv
+ local_tahoe = "bin/tahoe"
+
+script = os.path.join(base, "support", local_tahoe)