9 import fake_py2deb as py2deb
14 __appname__ = constants.__app_name__
15 __description__ = """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 Homepage: http://www.lds.org
23 __author__ = "The Church of Jesus Christ of Latter-day Saints"
25 __version__ = constants.__version__
26 __build__ = constants.__build__
32 __postinstall__ = """#!/bin/sh -e
34 gtk-update-icon-cache -f /usr/share/icons/hicolor
38 def find_files(prefix, path):
39 for root, dirs, files in os.walk(path):
41 if file.startswith(prefix+"-"):
42 fileParts = file.split("-")
43 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
44 assert unused == prefix
45 relPath = os.sep.join(relPathParts)
46 yield relPath, file, newName
49 def unflatten_files(files):
51 for relPath, oldName, newName in files:
54 d[relPath].append((oldName, newName))
58 def build_package(distribution):
60 os.chdir(os.path.dirname(sys.argv[0]))
64 py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
65 p = py2deb.Py2deb(__appname__)
66 p.prettyName = constants.__pretty_app_name__
67 p.description = __description__
69 p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
73 p.depends = ", ".join([
74 "python2.6 | python2.5",
75 "python-gtk2 | python2.5-gtk2",
76 "python-xml | python2.5-xml",
77 "python-dbus | python2.5-dbus",
78 "python-gst0.10 | python2.5-gst0.10",
80 maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"
82 "debian": ", python-glade2",
83 "diablo": maemoSpecificDepends + "",
84 "fremantle": maemoSpecificDepends + ", python-glade2",
86 p.recommends = ", ".join([
90 "diablo": "user/multimedia",
91 "fremantle": "user/multimedia",
95 p.distribution = "diablo fremantle debian"
96 p.repository = "extras"
97 p.changelog = __changelog__
98 p.postinstall = __postinstall__
99 p.icon = "48x48-MormonChannel.png"
100 p["/opt/MormonChannel/bin"] = ["MormonChannel.py"]
101 for relPath, files in unflatten_files(find_files("src", ".")).iteritems():
102 fullPath = "/opt/MormonChannel/lib"
104 fullPath += os.sep+relPath
106 "|".join((oldName, newName))
107 for (oldName, newName) in files
109 for relPath, files in unflatten_files(find_files("data", ".")).iteritems():
110 fullPath = "/opt/MormonChannel/share"
112 fullPath += os.sep+relPath
114 "|".join((oldName, newName))
115 for (oldName, newName) in files
117 p["/usr/share/applications/hildon"] = ["MormonChannel.desktop"]
118 p["/usr/share/icons/hicolor/48x48/hildon"] = ["48x48-MormonChannel.png|MormonChannel.png"]
120 if distribution == "debian":
123 version="%s-%s" % (__version__, __build__),
124 changelog=__changelog__,
130 print "Building for %s finished" % distribution
134 version="%s-%s" % (__version__, __build__),
135 changelog=__changelog__,
141 print "Building for %s finished" % distribution
144 if __name__ == "__main__":
145 if len(sys.argv) > 1:
151 if optparse is not None:
152 parser = optparse.OptionParser()
153 (commandOptions, commandArgs) = parser.parse_args()
156 commandArgs = ["diablo"]
157 build_package(commandArgs[0])