[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10826] trunk/blender: === SCons ===
Nathan Letwory
jesterking at letwory.net
Thu May 31 09:42:54 CEST 2007
Revision: 10826
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10826
Author: jesterking
Date: 2007-05-31 09:42:54 +0200 (Thu, 31 May 2007)
Log Message:
-----------
=== SCons ===
FINALLY! With this commit command-length problems are History. Thanks go to xuru from #scons for giving the nice pointer.
src is now again one lib, and further libsplitting should be rather unnecessary, unless we somehow reach the 37K limit (for internally used CreateProcess, by subprocess module)
Modified Paths:
--------------
trunk/blender/SConstruct
trunk/blender/source/blender/src/SConscript
trunk/blender/tools/btools.py
Modified: trunk/blender/SConstruct
===================================================================
--- trunk/blender/SConstruct 2007-05-31 07:33:18 UTC (rev 10825)
+++ trunk/blender/SConstruct 2007-05-31 07:42:54 UTC (rev 10826)
@@ -74,8 +74,8 @@
#on defaut white Os X terminal, some colors are totally unlegible
if platform=='darwin':
- B.bc.OKGREEN = '\033[34m'
- B.bc.WARNING = '\033[36m'
+ B.bc.OKGREEN = '\033[34m'
+ B.bc.WARNING = '\033[36m'
# arguments
print B.bc.HEADER+'Command-line arguments'+B.bc.ENDC
@@ -115,6 +115,8 @@
env.Tool('mstoolkit', ['tools'])
else:
env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
+ if env:
+ btools.SetupSpawn(env)
else:
env = BlenderEnvironment(ENV = os.environ)
@@ -122,7 +124,7 @@
print "Could not create a build environment"
Exit()
-env.SConscriptChdir(0)
+
cc = B.arguments.get('CC', None)
cxx = B.arguments.get('CXX', None)
if cc:
@@ -135,54 +137,8 @@
elif env['CC'] in ['gcc'] and sys.platform=='win32':
platform = 'win32-mingw'
-# Fix me!
-#if platform == 'win32-mingw':
-if 0:
- try:
- import win32file
- import win32event
- import win32process
- import win32security
- import string
+env.SConscriptChdir(0)
- 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'
@@ -285,7 +241,7 @@
Exit()
install_base_dir = os.getcwd() + "\\"
-
+
if not os.path.exists(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include'):
os.mkdir(install_base_dir+env['BF_INSTALLDIR']+'/plugins/include')
@@ -484,8 +440,6 @@
##### END SETUP ##########
Export('env')
-#Export('root_build_dir') # this one is still needed for makesdna
-##TODO: improve makesdna usage
BuildDir(B.root_build_dir+'/intern', 'intern', duplicate=0)
SConscript(B.root_build_dir+'/intern/SConscript')
Modified: trunk/blender/source/blender/src/SConscript
===================================================================
--- trunk/blender/source/blender/src/SConscript 2007-05-31 07:33:18 UTC (rev 10825)
+++ trunk/blender/source/blender/src/SConscript 2007-05-31 07:42:54 UTC (rev 10826)
@@ -4,19 +4,7 @@
# TODO: src_env.Append (CCFLAGS = user_options_dict['SDL_CFLAGS'])
sources = env.Glob('*.c')
-numobj = len(sources)
-maxobj = 30
-numlibs = numobj / maxobj
-if (numobj % maxobj):
- numlibs = numlibs + 1
-subsources = []
-
-if (env['OURPLATFORM'] == 'win32-mingw'):
- for i in range(numlibs - 1):
- subsources.append(sources[i*maxobj:(i+1)*maxobj])
- subsources.append(sources[(numlibs-1)*maxobj:])
-
incs = ' #/intern/guardedalloc #/intern/memutil'
incs += ' ../blenlib ../makesdna ../blenkernel'
incs += ' ../include #/intern/bmfont ../imbuf ../render/extern/include'
@@ -67,8 +55,4 @@
if env['BF_BUILDINFO'] == 1:
defs.append('NAN_BUILDINFO')
-if (env['OURPLATFORM'] == 'win32-mingw'):
- for i in range(numlibs):
- env.BlenderLib ( libname = 'src%d' % (i), sources = subsources[i], includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] )
-else:
- env.BlenderLib ( libname = 'src', sources = sources, includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] )
+env.BlenderLib ( libname = 'src', sources = sources, includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] )
Modified: trunk/blender/tools/btools.py
===================================================================
--- trunk/blender/tools/btools.py 2007-05-31 07:33:18 UTC (rev 10825)
+++ trunk/blender/tools/btools.py 2007-05-31 07:42:54 UTC (rev 10826)
@@ -1,7 +1,9 @@
-import sys
-import StringIO
+import os
+import os.path
import SCons.Options
import SCons.Options.BoolOption
+import subprocess
+import string
Options = SCons.Options
BoolOption = SCons.Options.BoolOption
@@ -84,35 +86,28 @@
print '\t'+bc.WARNING+'Invalid target: '+bc.ENDC+t
return oklist
-
+class ourSpawn:
+ def ourspawn(self, sh, escape, cmd, args, env):
+ newargs = string.join(args[1:], ' ')
+ cmdline = cmd + " " + newargs
+ 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)
+ data, err = proc.communicate()
+ rv = proc.wait()
+ if rv:
+ print "====="
+ print err
+ print "====="
+ return rv
-class idBuffering:
- def buffered_spawn( self, sh, escape, cmd, args, env ):
- stderr = StringIO.StringIO()
- stdout = StringIO.StringIO()
- command_string = ''
- for i in args:
- if ( len( command_string ) ):
- command_string += ' '
- command_string += i
- try:
- retval = self.env['PSPAWN']( sh, escape, cmd, args, env, stdout, stderr )
- except OSError, x:
- if x.errno != 10:
- raise x
- print 'OSError ignored on command: %s' % command_string
- retval = 0
- sys.stdout.write( stdout.getvalue() )
- sys.stderr.write( stderr.getvalue() )
- return retval
+def SetupSpawn( env ):
+ buf = ourSpawn()
+ buf.ourenv = env
+ env['SPAWN'] = buf.ourspawn
-# get a clean error output when running multiple jobs
-def SetupBufferedOutput( env ):
- buf = idBuffering()
- buf.env = env
- env['SPAWN'] = buf.buffered_spawn
-
def read_opts(cfg, args):
localopts = Options.Options(cfg, args)
localopts.AddOptions(
More information about the Bf-blender-cvs
mailing list