From 5e5621e2d59575d543cc5c0aa69e8b9466b4e6d9 Mon Sep 17 00:00:00 2001
From: Sergey Sharybin <sergey.vfx@gmail.com>
Date: Thu, 8 Sep 2011 09:57:51 +0000
Subject: [PATCH] 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.
---
 game_engine_save_as_runtime.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/game_engine_save_as_runtime.py b/game_engine_save_as_runtime.py
index b5a81d6d7..b2b225212 100644
--- a/game_engine_save_as_runtime.py
+++ b/game_engine_save_as_runtime.py
@@ -38,13 +38,16 @@ import shutil
 
 
 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
-- 
GitLab