Bumping to 0.3.11
[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.11
25 * Saves the filter on restart
26 * Search finds text in the middle of titles, not just the beginning
27 * Import/Export (import appends rather than merges for now)
28
29 0.3.10
30 * Added panning [removed due not being able to edit]
31
32 0.3.9
33 * Fixed a typo (loss of db with this)
34 * Switched to a spinner and switched unit to a combo
35
36 0.3.8
37 * Fixed check boxes on Maemo
38
39 0.3.7
40 * Corrected the bug tracker link
41
42 0.3.6
43 * Adding filtering for new and complete in addition to all and active
44
45 0.3.5
46 * Bugfix: Fixing the application launcher
47
48 0.3.4
49 * Making rotation configurable in the Settings window
50 * Persisting full-screen / rotation settings
51
52 0.3.3
53 * Rotation support
54 * Turned the settings dialog into a window
55
56 0.3.2
57 * Massive code cleanup
58 * Re-arrangement of GTK Menus
59 * Added Maemo 5 Menu
60 * Moved Active/All filter to menu
61 * Moved Checkout All to menu
62 * Improved Search bar
63 * Removed unnesary UI elements
64 * Switched to real inconsistent check boxes for tasks
65 * Switching the settings dialog to be more Maemo 5 like
66
67 0.3.1
68 * I18N, extract de.po, add ru.po.
69
70 0.3.0
71 * Initial Release.
72 """
73
74
75 __postinstall__ = """#!/bin/sh -e
76
77 gtk-update-icon-cache -f /usr/share/icons/hicolor
78 rm -f ~/.multilist/multilist.log
79 """
80
81
82 def find_files(path, root):
83         print path, root
84         for unusedRoot, dirs, files in os.walk(path):
85                 for file in files:
86                         if file.startswith(root+"-"):
87                                 print "\t", root, file
88                                 fileParts = file.split("-")
89                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
90                                 assert unused == root
91                                 relPath = os.sep.join(relPathParts)
92                                 yield relPath, file, newName
93
94
95 def unflatten_files(files):
96         d = {}
97         for relPath, oldName, newName in files:
98                 if relPath not in d:
99                         d[relPath] = []
100                 d[relPath].append((oldName, newName))
101         return d
102
103
104 def build_package(distribution):
105         try:
106                 os.chdir(os.path.dirname(sys.argv[0]))
107         except:
108                 pass
109
110         py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
111         p = py2deb.Py2deb(__appname__)
112         p.prettyName = constants.__pretty_app_name__
113         p.description = __description__
114         p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=Multilist"
115         p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
116         p.author = __author__
117         p.mail = __email__
118         p.license = "gpl"
119         p.depends = ", ".join([
120                 "python2.6 | python2.5",
121                 "python-gtk2 | python2.5-gtk2",
122                 "python-xml | python2.5-xml",
123                 "python-dbus | python2.5-dbus",
124         ])
125         maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"
126         p.depends += {
127                 "debian": ", python-glade2",
128                 "diablo": maemoSpecificDepends,
129                 "fremantle": maemoSpecificDepends + ", python-glade2",
130         }[distribution]
131         p.section = {
132                 "debian": "editors",
133                 "diablo": "user/office",
134                 "fremantle": "user/office",
135         }[distribution]
136         p.arch = "all"
137         p.urgency = "low"
138         p.distribution = "diablo fremantle debian"
139         p.repository = "extras"
140         p.changelog = __changelog__
141         p.postinstall = __postinstall__
142         p.icon = {
143                 "debian": "26x26-multilist.png",
144                 "diablo": "26x26-multilist.png",
145                 "fremantle": "40x40-multilist.png", # Fremantle natively uses 48x48
146         }[distribution]
147         p["/usr/bin"] = [ "multilist.py" ]
148         for relPath, files in unflatten_files(find_files(".", "locale")).iteritems():
149                 fullPath = "/usr/share/locale"
150                 if relPath:
151                         fullPath += os.sep+relPath
152                 p[fullPath] = list(
153                         "|".join((oldName, newName))
154                         for (oldName, newName) in files
155                 )
156         for relPath, files in unflatten_files(find_files(".", "src")).iteritems():
157                 fullPath = "/usr/lib/multilist"
158                 if relPath:
159                         fullPath += os.sep+relPath
160                 p[fullPath] = list(
161                         "|".join((oldName, newName))
162                         for (oldName, newName) in files
163                 )
164         p["/usr/share/applications/hildon"] = ["multilist.desktop"]
165         p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-multilist.png|multilist.png"]
166         p["/usr/share/icons/hicolor/40x40/hildon"] = ["40x40-multilist.png|multilist.png"]
167         p["/usr/share/icons/hicolor/scalable/hildon"] = ["scale-multilist.png|multilist.png"]
168
169         if distribution == "debian":
170                 print p
171                 print p.generate(
172                         version="%s-%s" % (__version__, __build__),
173                         changelog=__changelog__,
174                         build=True,
175                         tar=False,
176                         changes=False,
177                         dsc=False,
178                 )
179                 print "Building for %s finished" % distribution
180         else:
181                 print p
182                 print p.generate(
183                         version="%s-%s" % (__version__, __build__),
184                         changelog=__changelog__,
185                         build=False,
186                         tar=True,
187                         changes=True,
188                         dsc=True,
189                 )
190                 print "Building for %s finished" % distribution
191
192
193 if __name__ == "__main__":
194         if len(sys.argv) > 1:
195                 try:
196                         import optparse
197                 except ImportError:
198                         optparse = None
199
200                 if optparse is not None:
201                         parser = optparse.OptionParser()
202                         (commandOptions, commandArgs) = parser.parse_args()
203         else:
204                 commandArgs = None
205                 commandArgs = ["diablo"]
206         build_package(commandArgs[0])