Changeset View
Changeset View
Standalone View
Standalone View
bin/utils.py
Show First 20 Lines • Show All 798 Lines • ▼ Show 20 Line(s) | 782 | def sign(fileNames : [str]) -> bool: | |||
---|---|---|---|---|---|
799 | if CraftCore.debug.verbose() > 0: | 799 | if CraftCore.debug.verbose() > 0: | ||
800 | command += ["/v"] | 800 | command += ["/v"] | ||
801 | else: | 801 | else: | ||
802 | command += ["/q"] | 802 | command += ["/q"] | ||
803 | for fileName in fileNames: | 803 | for fileName in fileNames: | ||
804 | if not system(command + [fileName], logCommand=False): | 804 | if not system(command + [fileName], logCommand=False): | ||
805 | return False | 805 | return False | ||
806 | return True | 806 | return True | ||
807 | | ||||
808 | def isBinary(fileName : str) -> bool: | ||||
809 | if os.path.islink(fileName): | ||||
810 | return False | ||||
811 | _, ext = os.path.splitext(fileName) | ||||
812 | if CraftCore.compiler.isWindows: | ||||
813 | if ext in {".dll", ".exe"}: | ||||
814 | return True | ||||
815 | else: | ||||
816 | if ext in {".so", ".dylib"} or os.access(fileName, os.X_OK): | ||||
817 | return True | ||||
818 | return False | ||||
819 | | ||||
820 | | ||||
821 | def getLibraryDeps(path): | ||||
822 | deps = [] | ||||
823 | if CraftCore.compiler.isMacOS: | ||||
824 | # based on https://github.com/qt/qttools/blob/5.11/src/macdeployqt/shared/shared.cpp | ||||
825 | infoRe = re.compile("^\\t(.+) \\(compatibility version (\\d+\\.\\d+\\.\\d+), "+ | ||||
826 | "current version (\\d+\\.\\d+\\.\\d+)\\)$") | ||||
827 | lines = subprocess.check_output(["otool", "-L", path], universal_newlines=True) | ||||
828 | lines = lines.split("\n") | ||||
829 | lines.pop(0)# name of the library | ||||
830 | for line in lines: | ||||
831 | if not line: | ||||
832 | continue | ||||
833 | match = infoRe.match(line) | ||||
834 | if match: | ||||
835 | deps.append(match[1]) | ||||
836 | return deps | ||||
837 | No newline at end of file |