1
# ***** BEGIN GPL LICENSE BLOCK *****
3
# This program is free software; you can redistribute it and/or
4
# modify it under the terms of the GNU General Public License
5
# as published by the Free Software Foundation; either version 2
6
# of the License, or (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software Foundation,
15
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
# Contributor(s): Campbell Barton
19
# #**** END GPL LICENSE BLOCK #****
24
This script runs inside blender and compiles all scripts into pyc files which
25
blender uses as modules.
27
./blender.bin --background -noaudio --python source/tools/compile_scripts.py
35
print("Run this script from within blender")
43
print("compiling blender/python scripts")
45
# check for portable python install
46
path_user = bpy.utils.resource_path('USER')
47
path_local = bpy.utils.resource_path('LOCAL')
48
if bpy.path.is_subdir(os.__file__, path_user):
49
print(" found local python:", path_user)
50
compile_paths.append(os.path.join(path_user, "python", "lib"))
51
elif bpy.path.is_subdir(os.__file__, path_local):
52
print(" found user python:", path_user)
53
compile_paths.append(os.path.join(path_local, "python", "lib"))
55
print(" found system python - skipping compile")
58
scripts = os.path.normpath(os.path.join(bpy.__file__, "..", "..", ".."))
59
print(" found `bpy` scripts:", scripts)
60
compile_paths.extend((os.path.join(scripts, "startup"),
61
os.path.join(scripts, "modules"),
62
os.path.join(scripts, "addons"),
65
print(" compiling paths...")
66
for fp in compile_paths:
69
for fp in compile_paths:
70
compileall.compile_dir(fp, force=True)
73
if __name__ == '__main__':