From 101c9e3f769d4849ce17e6f8ac341321149c827f Mon Sep 17 00:00:00 2001
From: Mitchell Stokes <mogurijin@gmail.com>
Date: Mon, 27 Jun 2011 05:43:35 +0000
Subject: [PATCH] Save as Runtime: Some minor changes to bundling Python:   *
 Now __pycache__ folders are ignored instead of *.pyc files (the only pyc
 files are in the __pycachce__ folders)   * Now 2.58/python/lib is copied over
 instead of just lib. This allows the runtime to take advantage of Blender's
 "bundled Python" features. Having the 2.58 folder also allows for other
 potential files that BGE users might eventually want (e.g., components).

---
 game_engine_save_as_runtime.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/game_engine_save_as_runtime.py b/game_engine_save_as_runtime.py
index 527234fae..281dd0756 100644
--- a/game_engine_save_as_runtime.py
+++ b/game_engine_save_as_runtime.py
@@ -19,9 +19,9 @@
 bl_info = {
     'name': 'Save As Runtime',
     'author': 'Mitchell Stokes (Moguri)',
-    'version': (0, 3, 0),
-    "blender": (2, 5, 7),
-    "api": 35622,
+    'version': (0, 3, 1),
+    "blender": (2, 5, 8),
+    "api": 37846,
     'location': 'File > Export',
     'description': 'Bundle a .blend file with the Blenderplayer',
     'warning': '',
@@ -131,15 +131,16 @@ def WriteRuntime(player_path, output_path, copy_python, overwrite_lib, copy_dlls
     
     if copy_python:
         print("Copying Python files...", end=" ")
-        src = os.path.join(blender_dir, bpy.app.version_string.split()[0], "python", "lib")
-        dst = os.path.join(runtime_dir, "lib")
+        py_folder = os.path.join(bpy.app.version_string.split()[0], "python", "lib")
+        src = os.path.join(blender_dir, py_folder)
+        dst = os.path.join(runtime_dir, py_folder)
         
         if os.path.exists(dst):
             if overwrite_lib:
                 shutil.rmtree(dst)
-                shutil.copytree(src, dst, ignore=lambda dir, contents: [i for i in contents if i.endswith('.pyc')])
+                shutil.copytree(src, dst, ignore=lambda dir, contents: [i for i in contents if i == '__pycache__'])
         else:
-            shutil.copytree(src, dst, ignore=lambda dir, contents: [i for i in contents if i.endswith('.pyc')])
+            shutil.copytree(src, dst, ignore=lambda dir, contents: [i for i in contents if i == '__pycache__'])
         
         print("done")
 
-- 
GitLab