Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dosbox-staging/dosbox-staging.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatryk Obara <dreamer.tan@gmail.com>2021-02-20 01:30:31 +0300
committerPatryk Obara <patryk.obara@gmail.com>2021-02-21 00:51:19 +0300
commit7d8c7053236d1cd6c338fef56260711617a6d7ac (patch)
treecf108385a1f902c6b09a8fb9ab241c8e11f28e69 /scripts
parent2f73b726e01dfca83c91ee1e172b7e4f34908eb7 (diff)
Move verify-macos-dylibs script out of hidden dir
Static analysis tools might skip over the scripts that are stored in a hidden directory.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/verify-macos-dylibs.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/scripts/verify-macos-dylibs.py b/scripts/verify-macos-dylibs.py
new file mode 100755
index 000000000..1ba417a4b
--- /dev/null
+++ b/scripts/verify-macos-dylibs.py
@@ -0,0 +1,53 @@
+#!/usr/bin/python3
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (C) 2021-2021 Patryk Obara <patryk.obara@gmail.com>
+
+# pylint: disable=invalid-name
+
+"""
+Verify if there are no problematic runtime dependencies for this macOS binary.
+"""
+
+import sys
+import subprocess
+
+
+if __name__ == '__main__':
+ result = subprocess.run(['otool', '-L', sys.argv[1]],
+ stdout=subprocess.PIPE,
+ check=True)
+ output = result.stdout.decode('utf-8').split('\n')
+
+ allowed_list = [
+ '/System/Library/Frameworks/AppKit.framework/',
+ '/System/Library/Frameworks/AudioToolbox.framework/',
+ '/System/Library/Frameworks/AudioUnit.framework/',
+ '/System/Library/Frameworks/Carbon.framework/',
+ '/System/Library/Frameworks/CoreAudio.framework/',
+ '/System/Library/Frameworks/CoreFoundation.framework/',
+ '/System/Library/Frameworks/CoreGraphics.framework/',
+ '/System/Library/Frameworks/CoreMIDI.framework/',
+ '/System/Library/Frameworks/CoreServices.framework/',
+ '/System/Library/Frameworks/CoreVideo.framework/',
+ '/System/Library/Frameworks/ForceFeedback.framework/',
+ '/System/Library/Frameworks/Foundation.framework/',
+ '/System/Library/Frameworks/GameController.framework/',
+ '/System/Library/Frameworks/IOKit.framework/',
+ '/System/Library/Frameworks/Metal.framework/',
+ '/System/Library/Frameworks/OpenGL.framework/',
+ '/usr/lib/',
+ ]
+
+ # skip first line (program name)
+ for desc in (line.strip() for line in output[1:]):
+ if not desc: # skip over empty string
+ continue
+ if any(desc.startswith(pfx) for pfx in allowed_list):
+ continue
+ print(f"Problematic runtime dependency: '{desc}'")
+ print("Is it installed by default on macOS system?")
+ sys.exit(1)
+
+ sys.exit(0)