From 25fd14bcf7a795a9e0fae38504199d440f911ff4 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Mon, 10 Aug 2020 04:13:05 -0400 Subject: [PATCH 1/2] Add libselinux.so.1 to pacakge allow list Some distros (Arch) don't use SELinux, so it won't be present on those systems. - Also, log an error if any file referenced by `ldd` as a dependency somehow can't be found when packaging. --- freeze.py | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/freeze.py b/freeze.py index c5a03a50b1..175a04368c 100644 --- a/freeze.py +++ b/freeze.py @@ -285,24 +285,39 @@ def find_files(directory, patterns): ] and not libpath_file.startswith("libxcb-") ) \ - or libpath_file in ["libgcrypt.so.11", "libQt5DBus.so.5", "libpng12.so.0", "libbz2.so.1.0", "libqxcb.so"]: + or libpath_file in [ + "libgcrypt.so.11", + "libQt5DBus.so.5", + "libpng12.so.0", + "libbz2.so.1.0", + "libqxcb.so", + "libselinux.so.1", + ]: # Ignore missing files if os.path.exists(libpath): filepath, filename = os.path.split(libpath) external_so_files.append((libpath, filename)) - - # Manually add missing files (that were missed in the above step). These files are required - # for certain distros (like Fedora, openSUSE, Debian, etc...) + else: + # This shouldn't really happen, since `ldd` is showing + # these files as linked into ones we're packaging + log.error( + "Skipped missing shared library: {}".format(libpath)) + + # Manually add missing files (that were missed in the above step). + # These files are required for certain distros + # (like Fedora, openSUSE, Debian, etc...) + # # Also add Glib related files (required for some distros) - for added_lib in [ARCHLIB + "libssl.so", - ARCHLIB + "libcrypto.so", - ARCHLIB + "libglib-2.0.so", - ARCHLIB + "libgio-2.0.so", - ARCHLIB + "libgmodule-2.0.so", - ARCHLIB + "libthread-2.0.so" - ]: + for added_lib in [ + ARCHLIB + "libssl.so", + ARCHLIB + "libcrypto.so", + ARCHLIB + "libglib-2.0.so", + ARCHLIB + "libgio-2.0.so", + ARCHLIB + "libgmodule-2.0.so", + ARCHLIB + "libthread-2.0.so" + ]: if os.path.exists(added_lib): external_so_files.append((added_lib, os.path.basename(added_lib))) else: From ec63f0980ad39538050201734e9b5bae0a72c91f Mon Sep 17 00:00:00 2001 From: Frank Dana Date: Mon, 17 Aug 2020 22:40:21 -0400 Subject: [PATCH 2/2] freeze.py: Formatting, tighten flow --- freeze.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/freeze.py b/freeze.py index 3c18b24c7c..e4ac69f31c 100644 --- a/freeze.py +++ b/freeze.py @@ -284,6 +284,7 @@ def find_files(directory, patterns): libpath = libdetailsparts[0].strip() libpath_file = os.path.basename(libpath) if (libpath + and os.path.exists(libpath) and not libpath.startswith("/lib") and "libnvidia-glcore.so" not in libpath and libpath_file not in [ @@ -307,7 +308,8 @@ def find_files(directory, patterns): "libpangoft2-1.0.so.0", "libharfbuzz.so.0", "libthai.so.0", - ]) or libpath_file in [ + ] + ) or libpath_file in [ "libgcrypt.so.11", "libQt5DBus.so.5", "libpng12.so.0", @@ -317,16 +319,9 @@ def find_files(directory, patterns): "libpcre.so.3", "libselinux.so.1", ]: - - # Ignore missing files - if os.path.exists(libpath): - filepath, filename = os.path.split(libpath) - external_so_files.append((libpath, filename)) - else: - # This shouldn't really happen, since `ldd` is showing - # these files as linked into ones we're packaging - log.error( - "Skipped missing shared library: {}".format(libpath)) + external_so_files.append((libpath, libpath_file)) + # Any other lib deps that fail to meet the inclusion + # criteria above will be silently skipped over elif sys.platform == "darwin": # Copy Mac specific files that cx_Freeze misses