File: macho_standalone.py

package info (click to toggle)
python-macholib 1.16.2%2Bds0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 520 kB
  • sloc: python: 4,279; makefile: 126; sh: 10
file content (30 lines) | stat: -rw-r--r-- 738 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python

import os
import sys

from macholib.MachOStandalone import MachOStandalone
from macholib.util import strip_files


def standaloneApp(path):
    if not (os.path.isdir(path) and os.path.exists(os.path.join(path, "Contents"))):
        print("%s: %s does not look like an app bundle" % (sys.argv[0], path))
        sys.exit(1)
    files = MachOStandalone(path).run()
    strip_files(files)


def main():
    print(
        "WARNING: 'macho_standalone' is deprecated, use "
        "'python -mmacholib standalone' instead"
    )
    if not sys.argv[1:]:
        raise SystemExit("usage: %s [appbundle ...]" % (sys.argv[0],))
    for fn in sys.argv[1:]:
        standaloneApp(fn)


if __name__ == "__main__":
    main()