diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2006-11-30 15:39:09 +0300 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2006-11-30 15:39:09 +0300 |
commit | 2f3c52bd67d6b642cc2f84264101950aac4f62f3 (patch) | |
tree | a375b841f09aaec9827f5ae95058c80af23a0f60 /SConstruct | |
parent | 01ab6d6f752a0cf94f2003ac1f9286a539c45c61 (diff) |
==SCons==
If win32all (http://sourceforge.net/project/showfiles.php?group_id=78018) is found,
use it to be able to build with scons/mingw in (very) long paths. If it is not found,
don't do anything groovy. This should make it possible to merge the cut up src lib.
Those concerned, please do test that.
This bit of code is from http://www.scons.org/wiki/LongCmdLinesOnWin32
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct index 813942c29e5..79799ea78e5 100644 --- a/SConstruct +++ b/SConstruct @@ -129,6 +129,52 @@ if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32': elif env['CC'] in ['gcc'] and sys.platform=='win32': platform = 'win32-mingw' +if platform == 'win32-mingw': + try: + import win32file + import win32event + import win32process + import win32security + import string + + slash= re.compile(r"\\") + + def myesc(b): + if b[0]!= "-": + b = slash.sub(r"\\\\", b[1:-1]) + return "\"" + b + "\"" + else: + return b + + def my_spawn(sh, escape, cmd, args, spawnenv): + for var in spawnenv: + spawnenv[var] = spawnenv[var].encode('ascii', 'replace') + + sAttrs = win32security.SECURITY_ATTRIBUTES() + StartupInfo = win32process.STARTUPINFO() + if cmd=='ar' and args[1]=='r': + args[1] = '-r' + newargs = string.join(map(myesc, args[1:]), ' ') + cmdline = cmd + " " + newargs + + # check for any special operating system commands + if cmd == 'del': + for arg in args[1:]: + win32file.DeleteFile(arg) + exit_code = 0 + else: + # otherwise execute the command. + hProcess, hThread, dwPid, dwTid = win32process.CreateProcess(None, cmdline, None, None, 1, 0, spawnenv, None, StartupInfo) + win32event.WaitForSingleObject(hProcess, win32event.INFINITE) + exit_code = win32process.GetExitCodeProcess(hProcess) + win32file.CloseHandle(hProcess); + win32file.CloseHandle(hThread); + return exit_code + + env['SPAWN'] = my_spawn + except: + print "install win32all from http://sourceforge.net/project/showfiles.php?group_id=78018" + crossbuild = B.arguments.get('BF_CROSS', None) if crossbuild and platform!='win32': platform = 'linuxcross' |