scons support for extracting python from the system on unix os's
This commit is contained in:
13
SConstruct
13
SConstruct
@@ -60,7 +60,6 @@ B = tools.Blender
|
||||
platform = sys.platform
|
||||
quickie = None
|
||||
quickdebug = None
|
||||
nsis_build = None
|
||||
|
||||
##### BEGIN SETUP #####
|
||||
|
||||
@@ -425,8 +424,6 @@ if env['OURPLATFORM']=='darwin':
|
||||
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 @@ scriptinstall = []
|
||||
|
||||
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 @@ if env['OURPLATFORM']!='darwin':
|
||||
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 @@ if env['OURPLATFORM']=='linux2':
|
||||
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 @@ if env['OURPLATFORM']=='linuxcross':
|
||||
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 @@ for targetdir,srcfile in zip(plugtargetlist, pluglist):
|
||||
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:
|
||||
|
||||
@@ -121,6 +121,7 @@ IF(WITH_INSTALL)
|
||||
)
|
||||
|
||||
# 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..."
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user