Cleaning up reference to spell check
[quicknote] / 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 note taking application in a similar vein as PalmOS Memos
16 .
17 Homepage: http://quicknote.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.7.10
25  * Moved history to the (app)menu
26  * Moved search to Ctrl+f and (app)menu
27  * Switched category selection over to a touch selector entry, making it prettier and easier
28  * Ctrl+w/q to quit
29
30 0.7.9
31  * UI Tweak: Removed "New Note..." due to weirdness and duplicated behavior
32  * UI Tweak: Added App Menu to access some category functionality
33  * Bugfix: Move To Category
34  * Bugfix: Removed carriage return on Ctrl+Enter
35  * Added .deb package support
36
37 0.7.8
38  * Spell checking (Desktop only)
39  * Fixing the application title
40  * Fremantle Support
41  * Ctrl+i and Ctrl+o to zoom in/out the interface
42  * Ctrl+enter to fullscreen app
43  * Ctrl+l to copy to clipboard the application debug log
44
45 0.7.7
46  * Slight modifications to the note history and SQL dialogs
47  * On zoom, also hiding the history status and button
48  * Touched up the note list, making it ellipsize at the end rather than scroll
49  * Storing of zoom, wordwrap, and fullscreen settings
50
51 0.7.6
52   * Line-wrap
53   * Zoom
54
55 0.7.4
56   * fixed small bugs
57   * move category
58
59 0.7.3
60   * fixed small bugs
61   * move category
62
63 0.7.2
64   * improved sync, fixed a small bug
65
66 0.7.1
67   * improved sync
68
69 0.7.0
70   * Initial Release.
71 """
72
73
74 __postinstall__ = """#!/bin/sh -e
75
76 gtk-update-icon-cache -f /usr/share/icons/hicolor
77 rm -f ~/.quicknote/quicknote.log
78 """
79
80
81 def find_files(path, root):
82         print path, root
83         for unusedRoot, dirs, files in os.walk(path):
84                 for file in files:
85                         if file.startswith(root+"-"):
86                                 print "\t", root, file
87                                 fileParts = file.split("-")
88                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
89                                 assert unused == root
90                                 relPath = os.sep.join(relPathParts)
91                                 yield relPath, file, newName
92
93
94 def unflatten_files(files):
95         d = {}
96         for relPath, oldName, newName in files:
97                 if relPath not in d:
98                         d[relPath] = []
99                 d[relPath].append((oldName, newName))
100         return d
101
102
103 def build_package(distribution):
104         try:
105                 os.chdir(os.path.dirname(sys.argv[0]))
106         except:
107                 pass
108
109         py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
110         p = py2deb.Py2deb(__appname__)
111         p.prettyName = constants.__pretty_app_name__
112         p.description = __description__
113         p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=quicknote"
114         p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
115         p.author = __author__
116         p.mail = __email__
117         p.license = "gpl"
118         p.depends = ", ".join([
119                 "python2.6 | python2.5",
120                 "python-gtk2 | python2.5-gtk2",
121                 "python-xml | python2.5-xml",
122         ])
123         maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"
124         p.depends += {
125                 "debian": ", python-glade2",
126                 "chinook": maemoSpecificDepends,
127                 "diablo": maemoSpecificDepends,
128                 "fremantle": maemoSpecificDepends + ", python-glade2",
129                 "mer": maemoSpecificDepends + ", python-glade2",
130         }[distribution]
131         p.section = {
132                 "debian": "editors",
133                 "chinook": "accessories",
134                 "diablo": "user/office",
135                 "fremantle": "user/office",
136                 "mer": "user/office",
137         }[distribution]
138         p.arch = "all"
139         p.urgency = "low"
140         p.distribution = "chinook diablo fremantle mer debian"
141         p.repository = "extras"
142         p.changelog = __changelog__
143         p.postinstall = __postinstall__
144         p.icon = {
145                 "debian": "26x26-quicknote.png",
146                 "chinook": "26x26-quicknote.png",
147                 "diablo": "26x26-quicknote.png",
148                 "fremantle": "48x48-quicknote.png", # Fremantle natively uses 48x48
149                 "mer": "48x48-quicknote.png",
150         }[distribution]
151         p["/usr/bin"] = [ "quicknote.py" ]
152         for relPath, files in unflatten_files(find_files(".", "locale")).iteritems():
153                 fullPath = "/usr/share/locale"
154                 if relPath:
155                         fullPath += os.sep+relPath
156                 p[fullPath] = list(
157                         "|".join((oldName, newName))
158                         for (oldName, newName) in files
159                 )
160         for relPath, files in unflatten_files(find_files(".", "src")).iteritems():
161                 fullPath = "/usr/lib/quicknote"
162                 if relPath:
163                         fullPath += os.sep+relPath
164                 p[fullPath] = list(
165                         "|".join((oldName, newName))
166                         for (oldName, newName) in files
167                 )
168         p["/usr/share/applications/hildon"] = ["quicknote.desktop"]
169         p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-quicknote.png|quicknote.png"]
170         p["/usr/share/icons/hicolor/40x40/hildon"] = ["40x40-quicknote.png|quicknote.png"]
171         p["/usr/share/icons/hicolor/48x48/hildon"] = ["48x48-quicknote.png|quicknote.png"]
172         p["/usr/share/icons/hicolor/scalable/hildon"] = ["scale-quicknote.png|quicknote.png"]
173
174         if distribution == "debian":
175                 print p
176                 print p.generate(
177                         version="%s-%s" % (__version__, __build__),
178                         changelog=__changelog__,
179                         build=True,
180                         tar=False,
181                         changes=False,
182                         dsc=False,
183                 )
184                 print "Building for %s finished" % distribution
185         else:
186                 print p
187                 print p.generate(
188                         version="%s-%s" % (__version__, __build__),
189                         changelog=__changelog__,
190                         build=False,
191                         tar=True,
192                         changes=True,
193                         dsc=True,
194                 )
195                 print "Building for %s finished" % distribution
196
197
198 if __name__ == "__main__":
199         if len(sys.argv) > 1:
200                 try:
201                         import optparse
202                 except ImportError:
203                         optparse = None
204
205                 if optparse is not None:
206                         parser = optparse.OptionParser()
207                         (commandOptions, commandArgs) = parser.parse_args()
208         else:
209                 commandArgs = None
210                 commandArgs = ["diablo"]
211         build_package(commandArgs[0])