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 # ==============================
20 # ==============================
22 # ==============================
26 SOURCE_DIR = sys.argv[1]
29 BUNDLE_NAME= "Quassel Client"
30 EXE_NAME = "quasselclient"
32 EXE_NAME = sys.argv[3]
33 BUNDLE_NAME = sys.argv[2]
35 # make the dir of the exe the target dir
36 if(os.path.dirname(EXE_NAME)):
37 CONTENTS_DIR = os.path.dirname(EXE_NAME) + "/"
38 CONTENTS_DIR += BUNDLE_NAME + ".app/Contents/"
40 BUNDLE_VERSION = "0.3.0"
41 ICON_FILE = "pics/quassel.icns"
45 os.makedirs(CONTENTS_DIR + "MacOS")
46 os.makedirs(CONTENTS_DIR + "Resources")
50 def copyFiles(exeFile, iconFile):
51 os.system("cp %s %sMacOs/%s" % (exeFile, CONTENTS_DIR.replace(' ', '\ '), BUNDLE_NAME.replace(' ', '\ ')))
52 os.system("cp %s/%s %s/Resources" % (SOURCE_DIR, iconFile, CONTENTS_DIR.replace(' ', '\ ')))
54 def createPlist(bundleName, iconFile, bundleVersion):
55 templateFile = file(SOURCE_DIR + "/scripts/build/Info.plist", 'r')
56 template = templateFile.read()
59 plistFile = file(CONTENTS_DIR + "Info.plist", 'w')
60 plistFile.write(template % {"BUNDLE_NAME" : bundleName,
61 "ICON_FILE" : iconFile[iconFile.rfind("/")+1:],
62 "BUNDLE_VERSION" : bundleVersion})
65 if __name__ == "__main__":
67 createPlist(BUNDLE_NAME, ICON_FILE, BUNDLE_VERSION)
68 copyFiles(EXE_NAME, ICON_FILE)