2 # -*- coding: iso-8859-1 -*-
4 ################################################################################
6 # 2008 June 27th by Marcus 'EgS' Eggenberger <egs@quassel-irc.org> #
8 # The author disclaims copyright to this source code. #
9 # This Python Script is in the PUBLIC DOMAIN. #
11 ################################################################################
13 # ==============================
15 # ==============================
21 # ==============================
23 # ==============================
27 SOURCE_DIR = sys.argv[1]
30 BUNDLE_NAME = "Quassel Client"
31 EXE_NAME = "quasselclient"
33 EXE_NAME = sys.argv[3]
34 BUNDLE_NAME = sys.argv[2]
36 # make the dir of the exe the target dir
37 if(os.path.dirname(EXE_NAME)):
38 CONTENTS_DIR = os.path.dirname(EXE_NAME) + "/"
39 CONTENTS_DIR += BUNDLE_NAME + ".app/Contents/"
41 BUNDLE_VERSION = commands.getoutput("git --git-dir=" + SOURCE_DIR + "/.git/ describe")
42 ICON_FILE = "pics/quassel.icns"
47 os.makedirs(CONTENTS_DIR + "MacOS")
48 os.makedirs(CONTENTS_DIR + "Resources")
53 def copyFiles(exeFile, iconFile):
54 os.system("cp %s %sMacOs/%s" % (exeFile, CONTENTS_DIR.replace(' ', '\ '), BUNDLE_NAME.replace(' ', '\ ')))
55 os.system("cp %s/%s %s/Resources" % (SOURCE_DIR, iconFile, CONTENTS_DIR.replace(' ', '\ ')))
58 def createPlist(bundleName, iconFile, bundleVersion):
59 templateFile = file(SOURCE_DIR + "/scripts/build/Info.plist", 'r')
60 template = templateFile.read()
63 plistFile = file(CONTENTS_DIR + "Info.plist", 'w')
64 plistFile.write(template % {"BUNDLE_NAME": bundleName,
65 "ICON_FILE": iconFile[iconFile.rfind("/") + 1:],
66 "BUNDLE_VERSION": bundleVersion})
69 if __name__ == "__main__":
71 createPlist(BUNDLE_NAME, ICON_FILE, BUNDLE_VERSION)
72 copyFiles(EXE_NAME, ICON_FILE)