aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2019-03-21 12:27:59 +0100
committerChristian Tismer <tismer@stackless.com>2019-03-21 12:08:35 +0000
commitb84b5a2f35bea95545c19ee313be5ec5db19eca6 (patch)
tree00f68ff1b2bf4ed023eace2cb3e2530898629569 /sources/shiboken2/libshiboken
parent59f19e8c59487acdeea504dbbe45b5fc9b4a96f0 (diff)
Amend the Embedding Patch for cx_Freeze
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>
Diffstat (limited to 'sources/shiboken2/libshiboken')
-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: