mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
Disable Python compilation cache during build (#7057)
* Disable Python compilation cache during build * More pythonic check for none
This commit is contained in:
parent
7c2e4f2f9c
commit
a2b490baa6
|
@ -2994,9 +2994,19 @@ def cp_z3py_to_build():
|
||||||
for f in files:
|
for f in files:
|
||||||
if f.endswith('.pyc'):
|
if f.endswith('.pyc'):
|
||||||
rmf(os.path.join(root, f))
|
rmf(os.path.join(root, f))
|
||||||
|
# We do not want a second copy of the compiled files in the system-wide cache,
|
||||||
|
# so we disable it temporarily. This is an issue with recent versions of MacOS
|
||||||
|
# where XCode's Python has a cache, but the build scripts don't have access to
|
||||||
|
# it (e.g. during OPAM package installation).
|
||||||
|
have_cache = hasattr(sys, 'pycache_prefix') and sys.pycache_prefix is not None
|
||||||
|
if have_cache:
|
||||||
|
pycache_prefix_before = sys.pycache_prefix
|
||||||
|
sys.pycache_prefix = None
|
||||||
# Compile Z3Py files
|
# Compile Z3Py files
|
||||||
if compileall.compile_dir(z3py_src, force=1) != 1:
|
if compileall.compile_dir(z3py_src, force=1) != 1:
|
||||||
raise MKException("failed to compile Z3Py sources")
|
raise MKException("failed to compile Z3Py sources")
|
||||||
|
if have_cache:
|
||||||
|
sys.pycache_prefix = pycache_prefix_before
|
||||||
if is_verbose:
|
if is_verbose:
|
||||||
print("Generated python bytecode")
|
print("Generated python bytecode")
|
||||||
# Copy sources to build
|
# Copy sources to build
|
||||||
|
|
Loading…
Reference in a new issue