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__
30 * Cut down on size of media
31 * Attempting to get Maemo 4.1 working
32 * Fixing a couple of issues for launching on Maemo 5
36 __postinstall__ = """#!/bin/sh -e
38 gtk-update-icon-cache -f /usr/share/icons/hicolor
39 rm -f ~/.%(name)s/%(name)s.log
40 """ % {"name": constants.__app_name__}
42 __preremove__ = """#!/bin/sh -e
46 def find_files(prefix, path):
47 for root, dirs, files in os.walk(path):
49 if file.startswith(prefix+"-"):
50 fileParts = file.split("-")
51 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
52 assert unused == prefix
53 relPath = os.sep.join(relPathParts)
54 yield relPath, file, newName
57 def unflatten_files(files):
59 for relPath, oldName, newName in files:
62 d[relPath].append((oldName, newName))
66 def build_package(distribution):
68 os.chdir(os.path.dirname(sys.argv[0]))
72 py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
73 p = py2deb.Py2deb(__appname__)
74 p.prettyName = constants.__pretty_app_name__
75 p.description = __description__
76 p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=Waters%%20of%%20Shiloah"
80 p.depends = ", ".join([
81 "python2.6 | python2.5",
82 "python-gtk2 | python2.5-gtk2",
83 "python-xml | python2.5-xml",
84 "python-dbus | python2.5-dbus",
85 "python-telepathy | python2.5-telepathy",
87 maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"
89 "debian": ", python-gst0.10",
90 "diablo": maemoSpecificDepends,
91 "fremantle": maemoSpecificDepends + ", python-gst0.10",
93 p.recommends = ", ".join([
97 "diablo": "user/multimedia",
98 "fremantle": "user/multimedia",
102 p.distribution = "diablo fremantle debian"
103 p.repository = "extras"
104 p.changelog = __changelog__
105 p.postinstall = __postinstall__
106 p.icon = "48x48-WatersOfShiloah.png"
107 p["/opt/WatersOfShiloah/bin"] = ["WatersOfShiloah.py"]
108 for relPath, files in unflatten_files(find_files("src", ".")).iteritems():
109 fullPath = "/opt/WatersOfShiloah/lib"
111 fullPath += os.sep+relPath
112 fileLocationTransforms = list(
113 "|".join((oldName, newName))
114 for (oldName, newName) in files
117 fileLocationTransforms.append({
118 "debian": "src-stream_gst.py|stream.py",
119 "diablo": "src-stream_osso.py|stream.py",
120 "fremantle": "src-stream_gst.py|stream.py",
122 p[fullPath] = fileLocationTransforms
123 for relPath, files in unflatten_files(find_files("data", ".")).iteritems():
124 fullPath = "/opt/WatersOfShiloah/share"
126 fullPath += os.sep+relPath
128 "|".join((oldName, newName))
129 for (oldName, newName) in files
131 p["/usr/share/applications/hildon"] = ["WatersOfShiloah.desktop"]
132 p["/usr/share/icons/hicolor/48x48/hildon"] = ["48x48-WatersOfShiloah.png|WatersOfShiloah.png"]
134 if distribution == "debian":
137 version="%s-%s" % (__version__, __build__),
138 changelog=__changelog__,
144 print "Building for %s finished" % distribution
148 version="%s-%s" % (__version__, __build__),
149 changelog=__changelog__,
155 print "Building for %s finished" % distribution
158 if __name__ == "__main__":
159 if len(sys.argv) > 1:
165 if optparse is not None:
166 parser = optparse.OptionParser()
167 (commandOptions, commandArgs) = parser.parse_args()
170 commandArgs = ["diablo"]
171 build_package(commandArgs[0])