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
37 rm -f ~/.%(name)s/%(name)s.log
38 """ % {"name": constants.__app_name__}
40 __preremove__ = """#!/bin/sh -e
44 def find_files(prefix, path):
45 for root, dirs, files in os.walk(path):
47 if file.startswith(prefix+"-"):
48 fileParts = file.split("-")
49 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
50 assert unused == prefix
51 relPath = os.sep.join(relPathParts)
52 yield relPath, file, newName
55 def unflatten_files(files):
57 for relPath, oldName, newName in files:
60 d[relPath].append((oldName, newName))
64 def build_package(distribution):
66 os.chdir(os.path.dirname(sys.argv[0]))
70 py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
71 p = py2deb.Py2deb(__appname__)
72 p.prettyName = constants.__pretty_app_name__
73 p.description = __description__
74 p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=Waters%%20of%%20Shiloah"
78 p.depends = ", ".join([
79 "python2.6 | python2.5",
80 "python-gtk2 | python2.5-gtk2",
81 "python-xml | python2.5-xml",
82 "python-dbus | python2.5-dbus",
83 "python-telepathy | python2.5-telepathy",
85 maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"
87 "debian": ", python-gst0.10",
88 "diablo": maemoSpecificDepends,
89 "fremantle": maemoSpecificDepends + ", python-gst0.10",
91 p.recommends = ", ".join([
95 "diablo": "user/multimedia",
96 "fremantle": "user/multimedia",
100 p.distribution = "diablo fremantle debian"
101 p.repository = "extras"
102 p.changelog = __changelog__
103 p.postinstall = __postinstall__
104 p.icon = "48x48-WatersOfShiloah.png"
105 p["/opt/WatersOfShiloah/bin"] = ["WatersOfShiloah.py"]
106 for relPath, files in unflatten_files(find_files("src", ".")).iteritems():
107 fullPath = "/opt/WatersOfShiloah/lib"
109 fullPath += os.sep+relPath
110 fileLocationTransforms = list(
111 "|".join((oldName, newName))
112 for (oldName, newName) in files
115 fileLocationTransforms.append({
116 "debian": "src-stream_gst.py|stream.py",
117 "diablo": "src-stream_osso.py|stream.py",
118 "fremantle": "src-stream_gst.py|stream.py",
120 p[fullPath] = fileLocationTransforms
121 for relPath, files in unflatten_files(find_files("data", ".")).iteritems():
122 fullPath = "/opt/WatersOfShiloah/share"
124 fullPath += os.sep+relPath
126 "|".join((oldName, newName))
127 for (oldName, newName) in files
129 p["/usr/share/applications/hildon"] = ["WatersOfShiloah.desktop"]
130 p["/usr/share/icons/hicolor/48x48/hildon"] = ["48x48-WatersOfShiloah.png|WatersOfShiloah.png"]
132 if distribution == "debian":
135 version="%s-%s" % (__version__, __build__),
136 changelog=__changelog__,
142 print "Building for %s finished" % distribution
146 version="%s-%s" % (__version__, __build__),
147 changelog=__changelog__,
153 print "Building for %s finished" % distribution
156 if __name__ == "__main__":
157 if len(sys.argv) > 1:
163 if optparse is not None:
164 parser = optparse.OptionParser()
165 (commandOptions, commandArgs) = parser.parse_args()
168 commandArgs = ["diablo"]
169 build_package(commandArgs[0])