Created
October 16, 2022 13:37
-
-
Save ookiineko/9099b4c13bf56ddf0724fceea0c0cc91 to your computer and use it in GitHub Desktop.
PyInstaller patches for Cygwin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 760e852c234a10e6be0e9213f8fa5286149a5c39 Mon Sep 17 00:00:00 2001 | |
From: Ookiineko <chiisaineko@protonmail.com> | |
Date: Sun, 16 Oct 2022 21:15:19 +0800 | |
Subject: [PATCH] building: utils: don't check verinfo and manifests on Cygwin | |
* since neither pywin32 nor pywin32-ctypes support Cygwin, we now | |
have to use this workaround in order to use PyInstaller on Cygwin. | |
Signed-off-by: Ookiineko <chiisaineko@protonmail.com> | |
--- | |
PyInstaller/building/utils.py | 8 ++++---- | |
1 file changed, 4 insertions(+), 4 deletions(-) | |
diff --git a/PyInstaller/building/utils.py b/PyInstaller/building/utils.py | |
index f2d39b1..da9ca3c 100644 | |
--- a/PyInstaller/building/utils.py | |
+++ b/PyInstaller/building/utils.py | |
@@ -33,7 +33,7 @@ | |
from PyInstaller.depend.bindepend import match_binding_redirect | |
from PyInstaller.utils import misc | |
-if is_win or is_cygwin: | |
+if is_win: | |
from PyInstaller.utils.win32 import versioninfo, winmanifest, winresource | |
if is_darwin: | |
@@ -248,7 +248,7 @@ def checkCache( | |
return cachedfile | |
# Optionally change manifest and its dependencies to private assemblies. | |
- if fnm.lower().endswith(".manifest") and (is_win or is_cygwin): | |
+ if fnm.lower().endswith(".manifest") and is_win: | |
manifest = winmanifest.Manifest() | |
manifest.filename = fnm | |
with open(fnm, "rb") as f: | |
@@ -280,7 +280,7 @@ def checkCache( | |
strict_arch_validation=strict_arch_validation, | |
) | |
# We need to avoid using UPX with Windows DLLs that have Control Flow Guard enabled, as it breaks them. | |
- if (is_win or is_cygwin) and versioninfo.pefile_check_control_flow_guard(fnm): | |
+ if (is_win and versioninfo.pefile_check_control_flow_guard(fnm)) or is_cygwin: | |
logger.info('Disabling UPX for %s due to CFG!', fnm) | |
elif misc.is_file_qt_plugin(fnm): | |
logger.info('Disabling UPX for %s due to it being a Qt plugin!', fnm) | |
@@ -318,7 +318,7 @@ def checkCache( | |
pass | |
os.chmod(cachedfile, 0o755) | |
- if os.path.splitext(fnm.lower())[1] in (".pyd", ".dll") and (is_win or is_cygwin): | |
+ if os.path.splitext(fnm.lower())[1] in (".pyd", ".dll") and is_win: | |
# When shared assemblies are bundled into the app, they may optionally be changed into private assemblies. | |
try: | |
res = winmanifest.GetManifestResources(os.path.abspath(cachedfile)) | |
-- | |
2.38.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment