User-visible rotation config and persistence of rotation config
[multilist] / support / builddeb.py
1 #!/usr/bin/python2.5
2
3 import os
4 import sys
5
6 try:
7         import py2deb
8 except ImportError:
9         import fake_py2deb as py2deb
10
11 import constants
12
13
14 __appname__ = constants.__app_name__
15 __description__ = """Simple list management application
16 .
17 Homepage: http://multilist.garage.maemo.org/
18 """
19 __author__ = "Christoph Wurstle"
20 __email__ = "n800@axique.net"
21 __version__ = constants.__version__
22 __build__ = constants.__build__
23 __changelog__ = """
24 0.3.4
25 * Making rotation configurable in the Settings window
26 * Persisting full-screen / rotation settings
27
28 0.3.3
29 * Rotation support
30 * Turned the settings dialog into a window
31
32 0.3.2
33 * Massive code cleanup
34 * Re-arrangement of GTK Menus
35 * Added Maemo 5 Menu
36 * Moved Active/All filter to menu
37 * Moved Checkout All to menu
38 * Improved Search bar
39 * Removed unnesary UI elements
40 * Switched to real inconsistent check boxes for tasks
41 * Switching the settings dialog to be more Maemo 5 like
42
43 0.3.1
44 * I18N, extract de.po, add ru.po.
45
46 0.3.0
47 * Initial Release.
48 """
49
50
51 __postinstall__ = """#!/bin/sh -e
52
53 gtk-update-icon-cache -f /usr/share/icons/hicolor
54 rm -f ~/.multilist/multilist.log
55 """
56
57
58 def find_files(path, root):
59         print path, root
60         for unusedRoot, dirs, files in os.walk(path):
61                 for file in files:
62                         if file.startswith(root+"-"):
63                                 print "\t", root, file
64                                 fileParts = file.split("-")
65                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
66                                 assert unused == root
67                                 relPath = os.sep.join(relPathParts)
68                                 yield relPath, file, newName
69
70
71 def unflatten_files(files):
72         d = {}
73         for relPath, oldName, newName in files:
74                 if relPath not in d:
75                         d[relPath] = []
76                 d[relPath].append((oldName, newName))
77         return d
78
79
80 def build_package(distribution):
81         try:
82                 os.chdir(os.path.dirname(sys.argv[0]))
83         except:
84                 pass
85
86         py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
87         p = py2deb.Py2deb(__appname__)
88         p.prettyName = constants.__pretty_app_name__
89         p.description = __description__
90         p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=quicknote"
91         p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
92         p.author = __author__
93         p.mail = __email__
94         p.license = "gpl"
95         p.depends = ", ".join([
96                 "python2.6 | python2.5",
97                 "python-gtk2 | python2.5-gtk2",
98                 "python-xml | python2.5-xml",
99                 "python-dbus | python2.5-dbus",
100         ])
101         maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"
102         p.depends += {
103                 "debian": ", python-glade2",
104                 "diablo": maemoSpecificDepends,
105                 "fremantle": maemoSpecificDepends + ", python-glade2",
106         }[distribution]
107         p.section = {
108                 "debian": "editors",
109                 "diablo": "user/office",
110                 "fremantle": "user/office",
111         }[distribution]
112         p.arch = "all"
113         p.urgency = "low"
114         p.distribution = "diablo fremantle debian"
115         p.repository = "extras"
116         p.changelog = __changelog__
117         p.postinstall = __postinstall__
118         p.icon = {
119                 "debian": "26x26-multilist.png",
120                 "diablo": "26x26-multilist.png",
121                 "fremantle": "40x40-multilist.png", # Fremantle natively uses 48x48
122         }[distribution]
123         p["/usr/bin"] = [ "multilist.py" ]
124         for relPath, files in unflatten_files(find_files(".", "locale")).iteritems():
125                 fullPath = "/usr/share/locale"
126                 if relPath:
127                         fullPath += os.sep+relPath
128                 p[fullPath] = list(
129                         "|".join((oldName, newName))
130                         for (oldName, newName) in files
131                 )
132         for relPath, files in unflatten_files(find_files(".", "src")).iteritems():
133                 fullPath = "/usr/lib/multilist"
134                 if relPath:
135                         fullPath += os.sep+relPath
136                 p[fullPath] = list(
137                         "|".join((oldName, newName))
138                         for (oldName, newName) in files
139                 )
140         p["/usr/share/applications/hildon"] = ["multilist.desktop"]
141         p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-multilist.png|multilist.png"]
142         p["/usr/share/icons/hicolor/40x40/hildon"] = ["40x40-multilist.png|multilist.png"]
143         p["/usr/share/icons/hicolor/scalable/hildon"] = ["scale-multilist.png|multilist.png"]
144
145         if distribution == "debian":
146                 print p
147                 print p.generate(
148                         version="%s-%s" % (__version__, __build__),
149                         changelog=__changelog__,
150                         build=True,
151                         tar=False,
152                         changes=False,
153                         dsc=False,
154                 )
155                 print "Building for %s finished" % distribution
156         else:
157                 print p
158                 print p.generate(
159                         version="%s-%s" % (__version__, __build__),
160                         changelog=__changelog__,
161                         build=False,
162                         tar=True,
163                         changes=True,
164                         dsc=True,
165                 )
166                 print "Building for %s finished" % distribution
167
168
169 if __name__ == "__main__":
170         if len(sys.argv) > 1:
171                 try:
172                         import optparse
173                 except ImportError:
174                         optparse = None
175
176                 if optparse is not None:
177                         parser = optparse.OptionParser()
178                         (commandOptions, commandArgs) = parser.parse_args()
179         else:
180                 commandArgs = None
181                 commandArgs = ["diablo"]
182         build_package(commandArgs[0])