9 import fake_py2deb as py2deb
14 __appname__ = constants.__app_name__
15 __description__ = """Media player for inspirational streaming radio and audiobooks including the KJV Bible
17 * "Mormon Channel" inspirational radio station
18 * Conference precedings and magazines from The Church of Jesus Christ of Latter-day Saints
19 * Scriptures, including King James Version of the Bible and the Book of Mormon
21 This application is not endorsed by The Church of Jesus Christ of Latter-day Saints
23 Homepage: http://watersofshiloah.garage.maemo.org
25 __author__ = "Ed Page"
26 __email__ = "eopage@byu.net"
27 __version__ = constants.__version__
28 __build__ = constants.__build__
34 __postinstall__ = """#!/bin/sh -e
36 gtk-update-icon-cache -f /usr/share/icons/hicolor
40 def find_files(prefix, path):
41 for root, dirs, files in os.walk(path):
43 if file.startswith(prefix+"-"):
44 fileParts = file.split("-")
45 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
46 assert unused == prefix
47 relPath = os.sep.join(relPathParts)
48 yield relPath, file, newName
51 def unflatten_files(files):
53 for relPath, oldName, newName in files:
56 d[relPath].append((oldName, newName))
60 def build_package(distribution):
62 os.chdir(os.path.dirname(sys.argv[0]))
66 py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
67 p = py2deb.Py2deb(__appname__)
68 p.prettyName = constants.__pretty_app_name__
69 p.description = __description__
71 p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
75 p.depends = ", ".join([
76 "python2.6 | python2.5",
77 "python-gtk2 | python2.5-gtk2",
78 "python-xml | python2.5-xml",
79 "python-dbus | python2.5-dbus",
80 "python-gst0.10 | python2.5-gst0.10",
82 maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"
85 "diablo": maemoSpecificDepends,
86 "fremantle": maemoSpecificDepends,
88 p.recommends = ", ".join([
92 "diablo": "user/multimedia",
93 "fremantle": "user/multimedia",
97 p.distribution = "diablo fremantle debian"
98 p.repository = "extras"
99 p.changelog = __changelog__
100 p.postinstall = __postinstall__
101 p.icon = "48x48-WatersOfShiloah.png"
102 p["/opt/WatersOfShiloah/bin"] = ["WatersOfShiloah.py"]
103 for relPath, files in unflatten_files(find_files("src", ".")).iteritems():
104 fullPath = "/opt/WatersOfShiloah/lib"
106 fullPath += os.sep+relPath
108 "|".join((oldName, newName))
109 for (oldName, newName) in files
111 for relPath, files in unflatten_files(find_files("data", ".")).iteritems():
112 fullPath = "/opt/WatersOfShiloah/share"
114 fullPath += os.sep+relPath
116 "|".join((oldName, newName))
117 for (oldName, newName) in files
119 p["/usr/share/applications/hildon"] = ["WatersOfShiloah.desktop"]
120 p["/usr/share/icons/hicolor/48x48/hildon"] = ["48x48-WatersOfShiloah.png|WatersOfShiloah.png"]
122 if distribution == "debian":
125 version="%s-%s" % (__version__, __build__),
126 changelog=__changelog__,
132 print "Building for %s finished" % distribution
136 version="%s-%s" % (__version__, __build__),
137 changelog=__changelog__,
143 print "Building for %s finished" % distribution
146 if __name__ == "__main__":
147 if len(sys.argv) > 1:
153 if optparse is not None:
154 parser = optparse.OptionParser()
155 (commandOptions, commandArgs) = parser.parse_args()
158 commandArgs = ["diablo"]
159 build_package(commandArgs[0])