5 from shutil import copy, copytree
8 #print >>sys.stderr, cmdline
9 return os.system(cmdline)
13 head, tail = os.path.split(path)
14 path_list.insert(0, tail)
16 head, tail = os.path.split(head)
17 path_list.insert(0, tail)
19 for path_element in path_list:
20 created_path = os.path.join(created_path, path_element)
21 if not os.path.exists(created_path):
22 os.mkdir(created_path)
24 # useful information about building dmgs
25 # http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix
26 # http://developer.apple.com/documentation/developertools/Conceptual/SoftwareDistribution/Concepts/sd_disk_images.html
29 # need to detect what the real volume name is
30 mussa_mount = '/Volumes/Mussa'
31 mussarw_dmg = 'mussarw.dmg'
32 mussa_dmg = 'mussa.dmg'
33 system('hdiutil detach '+mussa_mount)
34 if os.path.exists(mussa_mount):
35 print >>sys.stderr, "Something is in", mussa_mount
37 if os.path.exists(mussarw_dmg):
38 os.unlink(mussarw_dmg)
39 if os.path.exists(mussa_dmg):
41 system('hdiutil create -size 64m -fs HFS+ -volname "Mussa" '+mussarw_dmg)
42 system('hdiutil attach '+mussarw_dmg)
44 copytree(app_dir, os.path.join(mussa_mount, app_dir))
46 system('hdiutil detach '+mussa_mount)
47 system('hdiutil convert '+mussarw_dmg +' -format UDZO -o '+mussa_dmg)
48 #system('hdiutil internet-enable -yes '+mussa_dmg)
51 framework_subpath = os.path.join("%(framework)s.framework", "Versions", "4.0", "%(framework)s")
52 frameworks = ['QtCore', 'QtGui', 'QtOpenGL']
54 qt_lib_dir="/usr/local/qt/4.1.0-shared/lib"
55 qt_framework=os.path.join(qt_lib_dir, framework_subpath)
58 app_dir=app_name+".app"
59 app_binary=app_dir+"/Contents/MacOS/"+app_name
60 app_framework=os.path.join(app_dir, "Contents", "Frameworks", framework_subpath)
61 if not os.path.exists(app_dir):
62 print >>sys.stderr, "please build mussagl first"
65 # install frameworks and update binary
66 for frame in frameworks:
67 qtframe = qt_framework % ({'framework': frame})
68 appframe = app_framework % ({'framework': frame})
69 exe_path = "@executable_path/../Frameworks/" + framework_subpath
70 exe_path %= ({'framework': frame})
71 mkdir(os.path.split(appframe)[0])
73 copy(qtframe, appframe)
74 system("install_name_tool -id "+exe_path+" "+appframe)
75 system("install_name_tool -change "+qtframe+" "+exe_path+" "+app_binary)
76 # now that everything is in place change the frameworks
78 for frame2 in frameworks:
79 qtframe2 = qt_framework % ({'framework': frame2})
80 contents_exe_path = "@executable_path/../Frameworks/" + framework_subpath
81 contents_exe_path %= ({'framework': frame2})
82 system("install_name_tool -change "+qtframe2+" "+contents_exe_path+" "+
86 if __name__ == "__main__":