Subversion Repositories Scribus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12462 avox 1
#!/usr/bin/python
2
 
3
import os
4
import sys
5
import osxtools
6
 
7
def usage():
8
        print """
9
 Usage: ingest.py bundle [-x lib] [-s fw]
10
 
11
        Copies all dependent libraries and frameworks into the app bundle.
12
        System libraries (/usr/lib*, /System/Library) are not copied.
13
        Fixes the dependencies in all executabels contained in bundle.
14
 
15
        bundle: the path to the *.app bundle
16
        -x lib: dont move lib into the bundle.
17
        -s fw:  only move the referenced libarry file from framework fw
18
                        into the bundle, not the complete framework
19
        """
20
 
21
 
22
if len(sys.argv) <= 1 or sys.argv[1] == "-?" :
23
        usage()
24
        sys.exit(0)
25
 
26
 
27
 
28
exceptions = []
29
strippedfws = []
30
bundle = None
31
 
32
argp = 1
33
 
34
while argp < len(sys.argv) :
35
        if sys.argv[argp] == '-x' :
36
                exceptions.append(sys.argv[argp + 1])
37
                argp = argp + 2
38
        elif sys.argv[argp][0:2] == '-x' :
39
                exceptions.append(sys.argv[argp][2:])
40
                argp = argp + 1
41
        elif sys.argv[argp] == '-s' :
42
                strippedfws.append(sys.argv[argp + 1])
43
                argp = argp + 2
44
        elif  sys.argv[argp][0:2] == '-s' :
45
                strippedfws.append(sys.argv[argp][2:])
46
                argp = argp + 1
47
        elif  sys.argv[argp][0:1] == '-' :
48
                print "Error: unknown option: " + sys.argv[argp]
49
                usage()
50
                sys.exit(1)
51
        elif bundle == None:
52
                bundle = sys.argv[argp]
53
                argp = argp + 1
54
        else:
55
                print "Error: more than one bundle path specified!"
56
                usage()
57
                sys.exit(1)
58
 
59
if bundle == None:     
60
        print "Error: no bundle path specified!"
61
        usage()
62
        sys.exit(1)
63
 
64
if not os.path.isabs(bundle):
65
        bundle = os.path.join(os.getenv("PWD"), bundle)
66
 
67
if not os.path.isdir(bundle):
68
        print "Error: '" + bundle + "' is no bundle path!"
69
        usage()
70
        sys.exit(1)
71
 
72
osxtools.ingest(bundle, exceptions, strippedfws)