10
Usage: mkframework.py bundle [-l libfile] [-v version]
12
Creates the directory structure for a framework.
13
If libfile is given, it will be used as the frameworks executable,
14
otherwise the framework will just be an empty shell.
16
bundle: the path to the *.framework bundle
17
-l lib: copy lib into the bundle.
18
-v ver: use "ver" as the version instead of the standard 'A'
19
-f: overwrite existing files if version exists
23
if len(sys.argv) <= 1 or sys.argv[1] == "-?" :
36
while argp < len(sys.argv) :
37
if sys.argv[argp] == '-f':
40
elif sys.argv[argp] == '-l' :
41
libfile = (sys.argv[argp + 1])
43
elif sys.argv[argp][0:2] == '-l' :
44
libfile = (sys.argv[argp][2:])
46
elif sys.argv[argp] == '-v' :
47
version = (sys.argv[argp + 1])
49
elif sys.argv[argp][0:2] == '-v' :
50
version = (sys.argv[argp][2:])
52
elif sys.argv[argp][0:1] == '-' :
53
print "Error: unknown option: " + sys.argv[argp]
57
bundle = sys.argv[argp]
60
print "Error: more than one bundle path specified!"
65
print "Error: no bundle path specified!"
69
if not os.path.isabs(bundle):
70
bundle = os.path.join(os.getenv("PWD"), bundle)
72
if bundle[-10 : ] != ".framework":
73
bundle = bundle + ".framework"
74
fwName = os.path.basename(bundle)[0: -10]
76
if not os.path.exists(bundle):
77
os.makedirs(bundle, 0755)
78
elif not os.path.isdir(bundle):
79
print "Error: '" + bundle + "' is no bundle path!"
83
versionPath = os.path.join(bundle, "Versions", version)
85
if os.path.exists(versionPath):
87
shutil.removetree(versionPath)
89
print "Error: '" + versionPath + "' already exists!"
93
os.makedirs(versionPath, 0755)
96
shutil.copy(libfile, os.path.join(versionPath, fwName))
97
os.system("install_name_tool -id @executable_path/" +
98
os.path.join("../Frameworks",
99
fwName + ".framework",
104
os.path.join(versionPath, fwName))
106
osxtools.createSymlinks(bundle, [
107
("Versions/Current", version),
108
(fwName, os.path.join("Versions/Current", fwName)),
109
("Headers", "Versions/Current/Headers")