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