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"
46 os.makedirs(CONTENTS_DIR + "MacOS")
47 os.makedirs(CONTENTS_DIR + "Resources")
51 def copyFiles(exeFile, iconFile):
52 os.system("cp %s %sMacOs/%s" % (exeFile, CONTENTS_DIR.replace(' ', '\ '), BUNDLE_NAME.replace(' ', '\ ')))
53 os.system("cp %s/%s %s/Resources" % (SOURCE_DIR, iconFile, CONTENTS_DIR.replace(' ', '\ ')))
55 def createPlist(bundleName, iconFile, bundleVersion):
56 templateFile = file(SOURCE_DIR + "/scripts/build/Info.plist", 'r')
57 template = templateFile.read()
60 plistFile = file(CONTENTS_DIR + "Info.plist", 'w')
61 plistFile.write(template % {"BUNDLE_NAME" : bundleName,
62 "ICON_FILE" : iconFile[iconFile.rfind("/")+1:],
63 "BUNDLE_VERSION" : bundleVersion})
66 if __name__ == "__main__":
68 createPlist(BUNDLE_NAME, ICON_FILE, BUNDLE_VERSION)
69 copyFiles(EXE_NAME, ICON_FILE)