build system now exclude config-*, turtledemo when copying system python.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 28 Feb 2011 05:59:44 +0000 (05:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 28 Feb 2011 05:59:44 +0000 (05:59 +0000)
also remove __pycache__ dirs when cleaning (new in python 3.2)

build_files/scons/tools/Blender.py
release/scripts/modules/bpy/utils.py
source/creator/CMakeLists.txt

index cab245a45181d7c9defbf9882041ff7f3d43149f..64d0a3f0caa1832471ba1e918b381eb374bc25ae 100644 (file)
@@ -624,31 +624,36 @@ def UnixPyBundle(target=None, source=None, env=None):
         print '\t"%s"' %            py_target
         print '\t(skipping copy)\n'
         return
-        
-    
+
     # 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
+    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 -f '%s/lib-dynload/_tkinter.so'" % py_target)
+    run("find '%s' -type d -name 'test' -prune -exec rm -rf {} ';'" % py_target)
+    run("find '%s' -type d -name 'config-*' -prune -exec rm -rf {} ';'" % py_target)
+    run("find '%s' -type d -name 'turtledemo' -prune -exec rm -rf {} ';'" % py_target)
+    run("find '%s' -type d -name '__pycache__' -exec rm -rf {} ';'" % py_target)
+    run("find '%s' -name '*.py[co]' -exec rm -rf {} ';'" % py_target)
+    run("find '%s' -name '*.so' -exec strip -s {} ';'" % py_target)
     
-    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 -f "%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 #########
 
index e98577c33100325b1685a53f6feb9ac30e0dbf61..591a309cf812f20669602b7d691dc27d868ba20f 100644 (file)
@@ -23,10 +23,7 @@ This module contains utility functions specific to blender but
 not assosiated with blenders internal data.
 """
 
-from _bpy import register_class
-from _bpy import unregister_class
-
-from _bpy import blend_paths
+from _bpy import register_class, unregister_class, blend_paths
 from _bpy import script_paths as _bpy_script_paths
 from _bpy import user_resource as _user_resource
 
index 375ddb944f1329fbc7a218702d81b4502e2b8539..d4317e48677722815d351b6b10fb77414717b779 100644 (file)
@@ -218,7 +218,8 @@ if(WITH_INSTALL)
                                TARGET blender POST_BUILD MAIN_DEPENDENCY blender
                                COMMENT "copying blender scripts..."
                                COMMAND cp -R ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/${BLENDER_VERSION}/
-                               COMMAND find ${TARGETDIR} -name "*.py?" -prune -exec rm -rf {} "\;"
+                               COMMAND find ${TARGETDIR} -name '*.py[co]' -prune -exec rm -rf {} '\;'
+                               COMMAND find ${TARGETDIR} -name '__pycache__' -exec rmdir {} '+'
                        )
                        if(WITH_PYTHON_INSTALL)
                                # Copy the systems python into the install directory
@@ -241,9 +242,12 @@ if(WITH_INSTALL)
                                        COMMAND mkdir ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/site-packages  # python needs it.
 
                                        COMMAND rm -f ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION}/lib-dynload/_tkinter.so
-                                       COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "test" -prune -exec rm -rf {} "\;"
-                                       COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "*.py?" -exec rm -rf {} "\;"
-                                       COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name "*.so"-exec strip -s {} "\;"
+                                       COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -type d -name 'test' -prune -exec rm -rf {} '\;'
+                                       COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -type d -name 'turtledemo' -prune -exec rm -rf {} '\;'
+                                       COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -type d -name 'config-*' -prune -exec rm -rf {} '\;'
+                                       COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name '*.py[co]' -exec rm -rf {} '\;'
+                                       COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name '__pycache__' -exec rmdir {} '+'
+                                       COMMAND find ${TARGETDIR}/${BLENDER_VERSION}/python/lib/python${PYTHON_VERSION} -name '*.so' -exec strip -s {} '\;'
                                )
                        endif()
                endif()
@@ -489,7 +493,8 @@ if(WITH_INSTALL)
                                COMMAND cp -Rf ${CMAKE_SOURCE_DIR}/release/scripts ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/
                                COMMAND mkdir ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
                                COMMAND unzip -q ${LIBDIR}/release/${PYTHON_ZIP} -d ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION}/python/
-                               COMMAND find ${TARGETDIR}/blender.app -name "*.py?" -prune -exec rm -rf {} "\;"
+                               COMMAND find ${TARGETDIR}/blender.app -name '*.py[co]' -prune -exec rm -rf {} ';'
+                               COMMAND find ${TARGETDIR}/blender.app -name '__pycache__' -exec rmdir {} '+'
                        )
                endif()   
        
@@ -497,7 +502,7 @@ if(WITH_INSTALL)
                        TARGET blender POST_BUILD MAIN_DEPENDENCY blender       
                        COMMAND find ${TARGETDIR}/blender.app -name .DS_Store -prune -exec rm -rf {} "\;"
                        COMMAND find ${TARGETDIR}/blender.app -name .svn -prune -exec rm -rf {} "\;"
-                                       COMMAND find ${TARGETDIR}/blender.app -name __MACOSX -prune -exec rm -rf {} "\;"
+                       COMMAND find ${TARGETDIR}/blender.app -name __MACOSX -prune -exec rm -rf {} "\;"
                )
        endif()