Commit 122bbe1d authored by Ingo Meyer's avatar Ingo Meyer

Python files are precompiled to improve app performance

parent 2bfc6eeb
......@@ -118,6 +118,10 @@ class LibPatchingError(Exception):
pass
class PrecompileError(Exception):
pass
class ExtensionModuleError(Exception):
pass
......@@ -335,6 +339,14 @@ def setup_startup(app_path, executable_path, app_executable_path, executable_roo
create_missing_library_links()
def precompile_python_files():
with open(os.devnull, 'w') as dummy:
try:
subprocess.check_call(['python', '-m', 'compileall', macos_path],
stdout=dummy, stderr=dummy)
except subprocess.CalledProcessError:
raise PrecompileError('Python modules could not be precompiled.')
def build_extension_modules(env_path):
def get_makefile_path():
if executable_root_path is not None and \
......@@ -367,6 +379,7 @@ def setup_startup(app_path, executable_path, app_executable_path, executable_roo
make_conda_portable(env_path)
if _conda_gr_included:
fix_conda_gr(env_path)
precompile_python_files()
if _extension_makefile is not None:
build_extension_modules(env_path)
env_startup_script = PY_PRE_STARTUP_CONDA_SETUP
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment