Skip to content
Snippets Groups Projects
Commit 101c9e3f authored by Mitchell Stokes's avatar Mitchell Stokes
Browse files

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).
parent 967056af
No related branches found
No related tags found
No related merge requests found
......@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment