diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-06-06 15:09:32 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-06-27 20:44:12 +0200 |
commit | 93f2091185ff4390ca8fc8901ebc68ebc35a218f (patch) | |
tree | c69f995ae6b3e20995747861c595ca1a8fef9942 /tools/my_spawn.py | |
parent | a0fcd8a7353ab692d864d3807974a93c097fb362 (diff) | |
download | redot-cpp-93f2091185ff4390ca8fc8901ebc68ebc35a218f.tar.gz |
[SCons] Move toolchains logic to tools folder.
Diffstat (limited to 'tools/my_spawn.py')
-rw-r--r-- | tools/my_spawn.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tools/my_spawn.py b/tools/my_spawn.py new file mode 100644 index 0000000..0b21419 --- /dev/null +++ b/tools/my_spawn.py @@ -0,0 +1,52 @@ +import os + + +def exists(env): + return os.name == "nt" + + +# Workaround for MinGW. See: +# http://www.scons.org/wiki/LongCmdLinesOnWin32 +def configure(env): + import subprocess + + def mySubProcess(cmdline, env): + # print "SPAWNED : " + cmdline + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + proc = subprocess.Popen( + cmdline, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + startupinfo=startupinfo, + shell=False, + env=env, + ) + data, err = proc.communicate() + rv = proc.wait() + if rv: + print("=====") + print(err.decode("utf-8")) + print("=====") + return rv + + def mySpawn(sh, escape, cmd, args, env): + + newargs = " ".join(args[1:]) + cmdline = cmd + " " + newargs + + rv = 0 + if len(cmdline) > 32000 and cmd.endswith("ar"): + cmdline = cmd + " " + args[1] + " " + args[2] + " " + for i in range(3, len(args)): + rv = mySubProcess(cmdline + args[i], env) + if rv: + break + else: + rv = mySubProcess(cmdline, env) + + return rv + + env["SPAWN"] = mySpawn + env.Replace(ARFLAGS=["q"]) |