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 * Fixing some orientation bugs
31 * Making log file rotate due to long release cycles
35 __postinstall__ = """#!/bin/sh -e
37 gtk-update-icon-cache -f /usr/share/icons/hicolor
38 rm -f ~/.%(name)s/%(name)s.log
39 """ % {"name": constants.__app_name__}
41 __preremove__ = """#!/bin/sh -e
45 def find_files(prefix, path):
46 for root, dirs, files in os.walk(path):
48 if file.startswith(prefix+"-"):
49 fileParts = file.split("-")
50 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
51 assert unused == prefix
52 relPath = os.sep.join(relPathParts)
53 yield relPath, file, newName
56 def unflatten_files(files):
58 for relPath, oldName, newName in files:
61 d[relPath].append((oldName, newName))
65 def build_package(distribution):
67 os.chdir(os.path.dirname(sys.argv[0]))
71 py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
72 p = py2deb.Py2deb(__appname__)
73 p.prettyName = constants.__pretty_app_name__
74 p.description = __description__
75 p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=Waters%%20of%%20Shiloah"
79 p.depends = ", ".join([
80 "python2.6 | python2.5",
81 "python-gtk2 | python2.5-gtk2",
82 "python-xml | python2.5-xml",
83 "python-dbus | python2.5-dbus",
84 "python-telepathy | python2.5-telepathy",
86 maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"
88 "debian": ", python-gst0.10",
89 "diablo": maemoSpecificDepends,
90 "fremantle": maemoSpecificDepends + ", python-gst0.10",
92 p.recommends = ", ".join([
96 "diablo": "user/multimedia",
97 "fremantle": "user/multimedia",
101 p.distribution = "diablo fremantle debian"
102 p.repository = "extras"
103 p.changelog = __changelog__
104 p.postinstall = __postinstall__
105 p.icon = "48x48-WatersOfShiloah.png"
106 p["/opt/WatersOfShiloah/bin"] = ["WatersOfShiloah.py"]
107 for relPath, files in unflatten_files(find_files("src", ".")).iteritems():
108 fullPath = "/opt/WatersOfShiloah/lib"
110 fullPath += os.sep+relPath
111 fileLocationTransforms = list(
112 "|".join((oldName, newName))
113 for (oldName, newName) in files
116 fileLocationTransforms.append({
117 "debian": "src-stream_gst.py|stream.py",
118 "diablo": "src-stream_osso.py|stream.py",
119 "fremantle": "src-stream_gst.py|stream.py",
121 p[fullPath] = fileLocationTransforms
122 for relPath, files in unflatten_files(find_files("data", ".")).iteritems():
123 fullPath = "/opt/WatersOfShiloah/share"
125 fullPath += os.sep+relPath
127 "|".join((oldName, newName))
128 for (oldName, newName) in files
130 p["/usr/share/applications/hildon"] = ["WatersOfShiloah.desktop"]
131 p["/usr/share/icons/hicolor/48x48/hildon"] = ["48x48-WatersOfShiloah.png|WatersOfShiloah.png"]
133 if distribution == "debian":
136 version="%s-%s" % (__version__, __build__),
137 changelog=__changelog__,
143 print "Building for %s finished" % distribution
147 version="%s-%s" % (__version__, __build__),
148 changelog=__changelog__,
154 print "Building for %s finished" % distribution
157 if __name__ == "__main__":
158 if len(sys.argv) > 1:
164 if optparse is not None:
165 parser = optparse.OptionParser()
166 (commandOptions, commandArgs) = parser.parse_args()
169 commandArgs = ["diablo"]
170 build_package(commandArgs[0])