[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2318] trunk/py/scripts/addons/ game_engine_save_as_runtime.py: Fix for "save as runtime" plugin on linux.

Sergey Sharybin g.ulairi at gmail.com
Thu Sep 8 11:57:52 CEST 2011


Revision: 2318
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2318
Author:   nazgul
Date:     2011-09-08 09:57:51 +0000 (Thu, 08 Sep 2011)
Log Message:
-----------
Fix for "save as runtime" plugin on linux.

It was broken since 2.58a and problem was caused by sysconfig
module which tried to parse python configuration header (pyconfig.h).

Use dirname(platform.__file__) to determine libpath for python.

Modified Paths:
--------------
    trunk/py/scripts/addons/game_engine_save_as_runtime.py

Modified: trunk/py/scripts/addons/game_engine_save_as_runtime.py
===================================================================
--- trunk/py/scripts/addons/game_engine_save_as_runtime.py	2011-09-08 05:35:13 UTC (rev 2317)
+++ trunk/py/scripts/addons/game_engine_save_as_runtime.py	2011-09-08 09:57:51 UTC (rev 2318)
@@ -38,14 +38,17 @@
 
 
 def CopyPythonLibs(dst, overwrite_lib, report=print):
-    import sysconfig
-    src = sysconfig.get_paths()['platstdlib']
-    # Unix 'platstdlib' excludes 'lib', eg:
-    #  '/usr/lib/python3.3' vs 'C:\blender\bin\2.58\python\Lib'
-    # in both cases we have to end up with './2.58/python/lib'
-    if sys.platform[:3] != "win":
-        dst = os.path.join(dst, os.path.basename(src))
+    import platform
 
+    # use python module to find pytohn's libpath
+    src = os.path.dirname(platform.__file__)
+
+    # dst points to lib/, but src points to current python's library path, eg:
+    #  '/usr/lib/python3.2' vs '/usr/lib'
+    # append python's library dir name to destination, so only python's
+    # libraries would be copied
+    dst = os.path.join(dst, os.path.basename(src))
+
     if os.path.exists(src):
         write = False
         if os.path.exists(dst):



More information about the Bf-extensions-cvs mailing list