diff options
author | Patrik Teivonen <patrik.teivonen@qt.io> | 2023-03-29 15:01:38 +0300 |
---|---|---|
committer | Patrik Teivonen <patrik.teivonen@qt.io> | 2023-04-06 10:58:36 +0000 |
commit | 569b15a9d38e8f0c9d1fa45e65940eed180f82a1 (patch) | |
tree | d948148acc7ec56a42ae1e1e8177493d156c6dcc | |
parent | 43cfc47b704b287dd1876eab0a653dfbc4807697 (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-- | Pipfile | 1 | ||||
-rwxr-xr-x | packaging-tools/sign_installer.py | 5 |
2 files changed, 2 insertions, 4 deletions
@@ -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 |