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__
33 __postinstall__ = """#!/bin/sh -e
35 gtk-update-icon-cache -f /usr/share/icons/hicolor
36 rm -f ~/.%(name)s/%(name)s.log
37 """ % {"name": constants.__app_name__}
39 __preremove__ = """#!/bin/sh -e
43 def find_files(prefix, path):
44 for root, dirs, files in os.walk(path):
46 if file.startswith(prefix+"-"):
47 fileParts = file.split("-")
48 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
49 assert unused == prefix
50 relPath = os.sep.join(relPathParts)
51 yield relPath, file, newName
54 def unflatten_files(files):
56 for relPath, oldName, newName in files:
59 d[relPath].append((oldName, newName))
63 def build_package(distribution):
65 os.chdir(os.path.dirname(sys.argv[0]))
69 py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
70 p = py2deb.Py2deb(__appname__)
71 p.prettyName = constants.__pretty_app_name__
72 p.description = __description__
73 p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=Waters%%20of%%20Shiloah"
77 p.depends = ", ".join([
78 "python2.6 | python2.5",
79 "python-gtk2 | python2.5-gtk2",
80 "python-xml | python2.5-xml",
81 "python-dbus | python2.5-dbus",
82 "python-telepathy | python2.5-telepathy",
84 maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"
86 "debian": ", python-gst0.10",
87 "diablo": maemoSpecificDepends,
88 "fremantle": maemoSpecificDepends + ", python-gst0.10",
90 p.recommends = ", ".join([
94 "diablo": "user/multimedia",
95 "fremantle": "user/multimedia",
99 p.distribution = "diablo fremantle debian"
100 p.repository = "extras"
101 p.changelog = __changelog__
102 p.postinstall = __postinstall__
103 p.icon = "48x48-WatersOfShiloah.png"
104 p["/opt/WatersOfShiloah/bin"] = ["WatersOfShiloah.py"]
105 for relPath, files in unflatten_files(find_files("src", ".")).iteritems():
106 fullPath = "/opt/WatersOfShiloah/lib"
108 fullPath += os.sep+relPath
109 fileLocationTransforms = list(
110 "|".join((oldName, newName))
111 for (oldName, newName) in files
114 fileLocationTransforms.append({
115 "debian": "src-stream_gst.py|stream.py",
116 "diablo": "src-stream_osso.py|stream.py",
117 "fremantle": "src-stream_gst.py|stream.py",
119 p[fullPath] = fileLocationTransforms
120 for relPath, files in unflatten_files(find_files("data", ".")).iteritems():
121 fullPath = "/opt/WatersOfShiloah/share"
123 fullPath += os.sep+relPath
125 "|".join((oldName, newName))
126 for (oldName, newName) in files
128 p["/usr/share/applications/hildon"] = ["WatersOfShiloah.desktop"]
129 p["/usr/share/icons/hicolor/48x48/hildon"] = ["48x48-WatersOfShiloah.png|WatersOfShiloah.png"]
131 if distribution == "debian":
134 version="%s-%s" % (__version__, __build__),
135 changelog=__changelog__,
141 print "Building for %s finished" % distribution
145 version="%s-%s" % (__version__, __build__),
146 changelog=__changelog__,
152 print "Building for %s finished" % distribution
155 if __name__ == "__main__":
156 if len(sys.argv) > 1:
162 if optparse is not None:
163 parser = optparse.OptionParser()
164 (commandOptions, commandArgs) = parser.parse_args()
167 commandArgs = ["diablo"]
168 build_package(commandArgs[0])