+
+def main(args):
+ qtroot = "/usr/local/qt-4.1.1"
+ bundle_dir = None
+ app_name = None
+
+ opts, args = getopt.getopt(args, "b:n:q:h",
+ ["bundle=", "name=", "qt-root=", "help"])
+ for option, argument in opts:
+ if option in ("-b", "--bundle"):
+ bundle_dir = argument
+ elif option in ("-n", "--name"):
+ app_name = argument
+ elif option in ("-q", "--qt-root"):
+ qtroot = argument
+ elif option in ("-h", "--help"):
+ print "-b | --bundle specify path to application bundle dir"
+ print "-n | --name specify application name (and volume name)"
+ print "-q | --qtdir where is qt is installed"
+ print "-h | --help how to use"
+ return 0
+
+ # compute bundle name/dir
+ if bundle_dir is None and app_name is None:
+ print >>sys.stderr, "I need a name or bundle path"
+ return 1
+ elif bundle_dir is None:
+ bundle_dir = app_name + ".app"
+ elif app_name is None:
+ # strip off trailing /
+ if bundle_dir[-1] == os.path.sep:
+ bundle_dir = bundle_dir[:-1]
+ path, file = os.path.split(bundle_dir)
+ app_name = os.path.splitext(file)[0]
+
+ if not os.path.exists(bundle_dir):
+ print >>sys.stderr, "couldn't find an app at %s" % (app_bundle)
+ return 1
+
+ qt_lib_dir = os.path.join(qtroot, 'lib')
+
+ prelinkqt(app_name, bundle_dir, qt_lib_dir)
+ makedmg([bundle_dir]+args, app_name)