9 import fake_py2deb as py2deb
14 __appname__ = constants.__app_name__
19 __author__ = "Ed Page"
20 __email__ = "eopage@byu.net"
21 __version__ = constants.__version__
22 __build__ = constants.__build__
27 __postinstall__ = """#!/bin/sh -e
29 gtk-update-icon-cache -f /usr/share/icons/hicolor
34 for root, dirs, files in os.walk(path):
36 if file.startswith("src-"):
37 fileParts = file.split("-")
38 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
39 assert unused == "src"
40 relPath = os.sep.join(relPathParts)
41 yield relPath, file, newName
44 def unflatten_files(files):
46 for relPath, oldName, newName in files:
49 d[relPath].append((oldName, newName))
53 def build_package(distribution):
55 os.chdir(os.path.dirname(sys.argv[0]))
59 py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
60 p = py2deb.Py2deb(__appname__)
61 p.prettyName = constants.__pretty_app_name__
62 p.description = __description__
64 p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
68 p.depends = ", ".join([
69 "python2.6 | python2.5",
70 "python-gtk2 | python2.5-gtk2",
71 "python-xml | python2.5-xml",
72 "python-dbus | python2.5-dbus",
74 maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"
76 "debian": ", python-glade2",
77 "diablo": maemoSpecificDepends + ", python2.5-conic",
78 "fremantle": maemoSpecificDepends + ", python-glade2, python-alarm",
80 p.recommends = ", ".join([
89 p.distribution = "diablo fremantle debian"
90 p.repository = "extras"
91 p.changelog = __changelog__
92 p.postinstall = __postinstall__
96 "fremantle": "", # Fremantle natively uses 48x48
98 p["/usr/bin"] = [ "" ]
99 for relPath, files in unflatten_files(find_files(".")).iteritems():
102 fullPath += os.sep+relPath
104 "|".join((oldName, newName))
105 for (oldName, newName) in files
107 p["/usr/share/applications/hildon"] = [""]
108 p["/usr/share/icons/hicolor/26x26/hildon"] = [""]
109 p["/usr/share/icons/hicolor/64x64/hildon"] = [""]
110 p["/usr/share/icons/hicolor/scalable/hildon"] = [""]
112 if distribution == "debian":
115 version="%s-%s" % (__version__, __build__),
116 changelog=__changelog__,
122 print "Building for %s finished" % distribution
126 version="%s-%s" % (__version__, __build__),
127 changelog=__changelog__,
133 print "Building for %s finished" % distribution
136 if __name__ == "__main__":
137 if len(sys.argv) > 1:
143 if optparse is not None:
144 parser = optparse.OptionParser()
145 (commandOptions, commandArgs) = parser.parse_args()
148 commandArgs = ["diablo"]
149 build_package(commandArgs[0])