aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrik Teivonen <patrik.teivonen@qt.io>2023-03-29 15:01:38 +0300
committerPatrik Teivonen <patrik.teivonen@qt.io>2023-04-06 10:58:36 +0000
commit569b15a9d38e8f0c9d1fa45e65940eed180f82a1 (patch)
treed948148acc7ec56a42ae1e1e8177493d156c6dcc
parent43cfc47b704b287dd1876eab0a653dfbc4807697 (diff)
sign_installer.py: Use 'file' for detecting Mach-O binariesv6.2.8-lts-packaging
Python's macholib library did not recognize all types of Mach-O headers Use 'file' utility to check for the file type instead. There is also 'python-magic' library but it relies on 'libmagic' which is not installed on macOS by default. Change-Id: Ib300590969415a65c187f096a7b6c80e9e8f8715 Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
-rw-r--r--Pipfile1
-rwxr-xr-xpackaging-tools/sign_installer.py5
2 files changed, 2 insertions, 4 deletions
diff --git a/Pipfile b/Pipfile
index e72668477..d5a4509de 100644
--- a/Pipfile
+++ b/Pipfile
@@ -25,7 +25,6 @@ validators = "==0.20.0"
aiofiles = "==0.8.0"
aiohttp = "==3.8.4"
typing_extensions = "==4.1.1"
-macholib = "==1.16.2"
[dev-packages]
ddt = "==1.6.0"
diff --git a/packaging-tools/sign_installer.py b/packaging-tools/sign_installer.py
index 889ca361b..5864f74a0 100755
--- a/packaging-tools/sign_installer.py
+++ b/packaging-tools/sign_installer.py
@@ -38,7 +38,6 @@ from shutil import rmtree
from subprocess import CalledProcessError
from typing import List, Optional, Tuple
-from macholib import MachO # type: ignore
from temppathlib import TemporaryDirectory
from bldinstallercommon import locate_paths
@@ -76,8 +75,8 @@ def _is_mach_o_file(path: Path) -> bool:
True if Mach-O header found successfully, otherwise False
"""
try:
- headers = MachO.MachO(path.resolve(strict=True)).headers
- return bool(headers)
+ # use 'file' utility to determine file type
+ return "Mach-O" in run_cmd(["file", str(path)])
except Exception:
return False