Skip to content

Commit 6adf3c1

Browse files
committed
Add ARCHLIB for system library path
- Will use `${ARCHLIB}` envvar, if set - Falls back to old hardcoded value otherwise - Check lib files exist before trying to freeze them
1 parent 33c7644 commit 6adf3c1

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

freeze.py

+18-9
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@
6464

6565
print (str(cx_Freeze))
6666

67+
# Set '${ARCHLIB}' envvar to override system library path
68+
ARCHLIB = os.getenv('ARCHLIB', "/usr/lib/x86_64-linux-gnu/")
69+
if not ARCHLIB.endswith('/'):
70+
ARCHLIB += '/'
71+
6772
# Packages to include
6873
python_packages = ["os",
6974
"sys",
@@ -221,7 +226,7 @@ def find_files(directory, patterns):
221226

222227
lib_list = [os.path.join(libopenshot_path, "libopenshot.so"),
223228
"/usr/local/lib/libresvg.so",
224-
"/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so"
229+
ARCHLIB + "qt5/plugins/platforms/libqxcb.so"
225230
] + pyqt5_mod_files
226231

227232
import subprocess
@@ -285,14 +290,18 @@ def find_files(directory, patterns):
285290

286291
# Manually add missing files (that were missed in the above step). These files are required
287292
# for certain distros (like Fedora, openSUSE, Debian, etc...)
288-
external_so_files.append(("/lib/x86_64-linux-gnu/libssl.so.1.0.0", "libssl.so.1.0.0"))
289-
external_so_files.append(("/lib/x86_64-linux-gnu/libcrypto.so.1.0.0", "libcrypto.so.1.0.0"))
290-
# Glib related files (required for some distros)
291-
external_so_files.append(("/usr/lib/x86_64-linux-gnu/libglib-2.0.so", "libglib-2.0.so"))
292-
external_so_files.append(("/usr/lib/x86_64-linux-gnu/libgio-2.0.so", "libgio-2.0.so"))
293-
external_so_files.append(("/usr/lib/x86_64-linux-gnu/libgmodule-2.0.so", "libgmodule-2.0.so"))
294-
external_so_files.append(("/usr/lib/x86_64-linux-gnu/libgthread-2.0.so", "libgthread-2.0.so"))
295-
293+
# Also add Glib related files (required for some distros)
294+
295+
for added_lib in [ARCHLIB + "libssl.so.1.0.0",
296+
ARCHLIB + "libcrypto.so.1.0.0",
297+
ARCHLIB + "libglib-2.0.so",
298+
ARCHLIB + "libgio-2.0.so",
299+
ARCHLIB + "libgmodule-2.0.so",
300+
ARCHLIB + "libthread-2.0.so"
301+
]:
302+
if os.path.exists(added_lib):
303+
external_so_files.append((added_lib, os.path.basename(added_lib)))
304+
296305
elif sys.platform == "darwin":
297306
# Copy Mac specific files that cx_Freeze misses
298307
# JPEG library

0 commit comments

Comments
 (0)