Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-08-17 11:34:41 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-08-17 11:34:41 +0400
commit22e68ba1bba88b07f63fbe22f0f1809611d44983 (patch)
tree3dc818597b2aa04958bc05a9aa1a0bb39cad5a96 /tools
parenta3b317daf7fbaa2359afbfdf0524b590d3622f2e (diff)
scons support for extracting python from the system on unix os's
Diffstat (limited to 'tools')
-rw-r--r--tools/Blender.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/Blender.py b/tools/Blender.py
index db888c38935..0d2671dbfac 100644
--- a/tools/Blender.py
+++ b/tools/Blender.py
@@ -383,6 +383,48 @@ def AppIt(target=None, source=None, env=None):
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 @@ class BlenderEnvironment(SConsEnvironment):
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):