aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2019-03-21 12:27:59 +0100
committerSimo Fält <simo.falt@qt.io>2019-03-21 14:37:54 +0000
commite91acf68a81d6dddf63b89469a272eacf5fe77c2 (patch)
tree30e43fab46923d9f490475506d20f19e096152b8
parent5d9dde30ad1672e1f2962dc25b97f9bcbe049e87 (diff)
Amend the Embedding Patch for cx_Freezev5.12.25.12.2
cx_Freeze has the bug that it copies the "files.dir" folder of shiboken, but does not insert the Python files. As a quick fix, instead of testing only for existence of this directory, we now check for existence of the loader.py file. It can be assumed that all other Python files will be there as well. We could go even further and test-load all files. But then it becomes questionable if we should better always embed. Change-Id: Ib9553941c6a658fb20cb85d22f78431f99d88734 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit b84b5a2f35bea95545c19ee313be5ec5db19eca6) Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--sources/shiboken2/libshiboken/embed/signature_bootstrap.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/sources/shiboken2/libshiboken/embed/signature_bootstrap.py b/sources/shiboken2/libshiboken/embed/signature_bootstrap.py
index 6ce5ab95a..eb182d8c4 100644
--- a/sources/shiboken2/libshiboken/embed/signature_bootstrap.py
+++ b/sources/shiboken2/libshiboken/embed/signature_bootstrap.py
@@ -109,7 +109,7 @@ def bootstrap():
import shibokenmodule as root
rp = os.path.realpath(os.path.dirname(root.__file__))
# This can be the shiboken2 directory or the binary module, so search.
- look_for = "files.dir"
+ look_for = os.path.join("files.dir", "shibokensupport", "signature", "loader.py")
while len(rp) > 3 and not os.path.exists(os.path.join(rp, look_for)):
rp = os.path.abspath(os.path.join(rp, ".."))
@@ -118,12 +118,14 @@ def bootstrap():
use_embedding = bool(getattr(sys, embedding_var, False))
# We keep the zip file for inspection if the sys variable has been set.
keep_zipfile = hasattr(sys, embedding_var)
- real_dir = os.path.join(rp, look_for)
+ loader_path = os.path.join(rp, look_for)
+ files_dir = os.path.abspath(os.path.join(loader_path, "..", "..", ".."))
+ assert files_dir.endswith("files.dir")
# We report in sys what we used. We could put more here as well.
- if not os.path.exists(real_dir):
+ if not os.path.exists(loader_path):
use_embedding = True
- support_path = prepare_zipfile() if use_embedding else real_dir
+ support_path = prepare_zipfile() if use_embedding else files_dir
setattr(sys, embedding_var, use_embedding)
try: