[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22554] branches/blender2.5/blender: scons support for extracting python from the system on unix os's

Campbell Barton ideasman42 at gmail.com
Mon Aug 17 09:34:42 CEST 2009


Revision: 22554
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22554
Author:   campbellbarton
Date:     2009-08-17 09:34:41 +0200 (Mon, 17 Aug 2009)

Log Message:
-----------
scons support for extracting python from the system on unix os's

Modified Paths:
--------------
    branches/blender2.5/blender/SConstruct
    branches/blender2.5/blender/source/creator/CMakeLists.txt
    branches/blender2.5/blender/tools/Blender.py

Modified: branches/blender2.5/blender/SConstruct
===================================================================
--- branches/blender2.5/blender/SConstruct	2009-08-17 07:07:25 UTC (rev 22553)
+++ branches/blender2.5/blender/SConstruct	2009-08-17 07:34:41 UTC (rev 22554)
@@ -60,7 +60,6 @@
 platform = sys.platform
 quickie = None
 quickdebug = None
-nsis_build = None
 
 ##### BEGIN SETUP #####
 
@@ -425,8 +424,6 @@
 		bundle = '%s.app' % prg[0]
 		bundledir = os.path.dirname(bundle)
 		for dp, dn, df in os.walk(bundle):
-			if 'CVS' in dn:
-				dn.remove('CVS')
 			if '.svn' in dn:
 				dn.remove('.svn')
 			dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
@@ -443,8 +440,6 @@
 
 if  env['OURPLATFORM']!='darwin':
 		for dp, dn, df in os.walk('bin/.blender'):
-			if 'CVS' in dn:
-				dn.remove('CVS')
 			if '.svn' in dn:
 				dn.remove('.svn')
 			
@@ -471,8 +466,6 @@
 			scriptpaths=['release/scripts', 'release/ui', 'release/io']
 			for scriptpath in scriptpaths:
 				for dp, dn, df in os.walk(scriptpath):
-					if 'CVS' in dn:
-						dn.remove('CVS')
 					if '.svn' in dn:
 						dn.remove('.svn')
 					dir=env['BF_INSTALLDIR']+'/.blender/'+os.path.basename(scriptpath)+dp[len(scriptpath):]
@@ -485,8 +478,6 @@
 	icontargetlist = []
 
 	for tp, tn, tf in os.walk('release/freedesktop/icons'):
-		if 'CVS' in tn:
-			tn.remove('CVS')
 		if '.svn' in tn:
 			tn.remove('.svn')
 		for f in tf:
@@ -509,8 +500,6 @@
 pluglist = []
 plugtargetlist = []
 for tp, tn, tf in os.walk('release/plugins'):
-	if 'CVS' in tn:
-		tn.remove('CVS')
 	if '.svn' in tn:
 		tn.remove('.svn')
 	for f in tf:
@@ -541,8 +530,6 @@
 textlist = []
 texttargetlist = []
 for tp, tn, tf in os.walk('release/text'):
-	if 'CVS' in tn:
-		tn.remove('CVS')
 	if '.svn' in tn:
 		tn.remove('.svn')
 	for f in tf:

Modified: branches/blender2.5/blender/source/creator/CMakeLists.txt
===================================================================
--- branches/blender2.5/blender/source/creator/CMakeLists.txt	2009-08-17 07:07:25 UTC (rev 22553)
+++ branches/blender2.5/blender/source/creator/CMakeLists.txt	2009-08-17 07:34:41 UTC (rev 22554)
@@ -121,6 +121,7 @@
       )
       
       # Copy the systems python into the install directory
+      # Scons copy in tools/Blender.py
       ADD_CUSTOM_COMMAND(
         TARGET blender POST_BUILD MAIN_DEPENDENCY blender
         COMMENT "copying a subset of the systems python..."

Modified: branches/blender2.5/blender/tools/Blender.py
===================================================================
--- branches/blender2.5/blender/tools/Blender.py	2009-08-17 07:07:25 UTC (rev 22553)
+++ branches/blender2.5/blender/tools/Blender.py	2009-08-17 07:34:41 UTC (rev 22554)
@@ -383,6 +383,48 @@
 	cmd = 'find %s/%s.app -name .DS_Store -exec rm -rf {} \;'%(builddir, binary)
 	commands.getoutput(cmd)
 
+# extract copy system python, be sure to update other build systems
+# when making changes to the files that are copied.
+def my_pyinst_print(target, source, env):
+	pass
+
+def PyInstall(target=None, source=None, env=None):
+	# Any Unix except osx
+	#-- .blender/python/lib/python3.1
+	
+	import commands
+	
+	def run(cmd):
+		print 'Install command:', cmd
+		commands.getoutput(cmd)
+	
+	py_src =	env.subst( env['BF_PYTHON_LIBPATH'] + '/python'+env['BF_PYTHON_VERSION'] )
+	py_target =	env.subst( env['BF_INSTALLDIR'] + '/.blender/python/lib/python'+env['BF_PYTHON_VERSION'] )
+	
+	# Copied from source/creator/CMakeLists.txt, keep in sync.
+	print 'Install python from:'
+	print '\t"%s" into...' %	py_src
+	print '\t"%s"\n' %			py_target
+	
+	run('rm -rf "%s"' % py_target)
+	try:	os.makedirs(os.path.dirname(py_target)) # the final part is copied
+	except:pass
+	
+	run('cp -R "%s" "%s"' % (py_src, os.path.dirname(py_target)))
+	run('rm -rf "%s/distutils"' % py_target)
+	run('rm -rf "%s/lib2to3"' % py_target)
+	run('rm -rf "%s/idlelib"' % py_target)
+	run('rm -rf "%s/tkinter"' % py_target)
+	run('rm -rf "%s/config"' % py_target)
+
+	run('rm -rf "%s/site-packages"' % py_target)
+	run('mkdir "%s/site-packages"' % py_target)    # python needs it.'
+
+	run('rm "%s/lib-dynload/_tkinter.so"' % py_target)
+	run('find "%s" -name "test" -prune -exec rm -rf {} \;' % py_target)
+	run('find "%s" -name "*.py?" -exec rm -rf {} \;' % py_target)
+	run('find "%s" -name "*.so"-exec strip -s {} \;' % py_target)
+
 #### END ACTION STUFF #########
 
 def bsc(env, target, source):
@@ -543,6 +585,11 @@
 		if  lenv['OURPLATFORM']=='darwin':
 			lenv['BINARYKIND'] = binarykind
 			lenv.AddPostAction(prog,Action(AppIt,strfunction=my_appit_print))
+		elif os.sep == '/': # any unix
+			if lenv['WITH_BF_PYTHON']:
+				if not lenv['WITHOUT_BF_INSTALL']:
+					lenv.AddPostAction(prog,Action(PyInstall,strfunction=my_pyinst_print))
+		
 		return prog
 
 	def Glob(lenv, pattern):





More information about the Bf-blender-cvs mailing list