4323b6200bc6168caeaa680d41b14575ae6f210d
[gc-dialer] / support / builddeb.py
1 #!/usr/bin/python2.5
2
3 """
4 @bug In update desrcription stuff
5 """
6
7 import os
8 import sys
9
10 try:
11         import py2deb
12 except ImportError:
13         import fake_py2deb as py2deb
14
15 import constants
16
17
18 __appname__ = constants.__app_name__
19 __description__ = "Touch screen enhanced interface to the GoogleVoice/GrandCentral phone service"
20 __author__ = "Ed Page"
21 __email__ = "eopage@byu.net"
22 __version__ = constants.__version__
23 __build__ = constants.__build__
24 __changelog__ = """
25 1.0.7
26 * Sped up various login cases
27 * Added descriptions to the callback numbers
28 * Collapsed conversations in the messages tab
29 * UI Tweak: Added more login status notifications
30 * UI Tweak: When no characters are entered, you can't send a text
31 * UI Tweak: Switched to TreeView's using no selection to match Fremantle
32 * Bug Fix: Expanded the types of the Enter key that are supported for going to full screen
33 * Bug Fix: Random people were reporting login issues
34 * Bug Fix: Hardened against issues with grabbing possible callback numbers
35 * Bug Fix: Fremantle GTK doesn't allow TreeView rows to be selected, so row-activated handlers have to read their path
36 * Bug Fix: Fremantle PyMaemo doesn't provide a function Mer PyMaemo does, created a hack to be workable on both
37 * Bug Fix: Once PyMaemo supports thumb button sizes, setting that for all of the random buttons
38 * Bug Fix: When debugging hildonization, dialogs weren't closing
39 * Bug Fix: Not properly hildonizing some code
40 * Debugging: Improved logging output
41 * Debugging: Printing page when can't get a callback number
42
43 1.0.6
44 * Fremantle Prep: Simplified menus in prep for no menu or the Fremantle App Menu
45 * Fremantle Prep: Implemented a work around for https://bugs.maemo.org/show_bug.cgi?id=4957
46 * Fremantle Prep: Switched to touch selectors for notification time, callback number, and contact addressbook
47 * Fremantle Prep: Making various widgets pannable rather than scrollable
48 * Fremantle Prep: CTRL-V added for paste for Dialpad
49 * Fremantle Prep: CTRL-Enter added for fullscreen
50 * UI Tweak: Phone selection and SMS Message dialogs now highlight the last message and are easier to scroll
51 * UI Tweak: Tweaked sizes of stuff on recent tab
52 * UI Tweak: Added notifcations for various things like login and dialing
53 * UI Tweak: Switch to accounts tab when logging in and callback is blank as a sublte hint to configure it
54 * UI Tweak: Switch to accounts tab on failed login to remind the user they are not logged in
55 * Packaging: Disables notifications on uninstall
56 * Packaging: Including a vastly improved py2deb for better packages (icons on package, etc)
57 * Debugging: Adding seperator between dialcentral launches in log
58 * Bug Fix: Made startup more error resistant
59 * Bug Fix: some dependencies for Diablo
60 * Bug Fix: Error on refreshing tabs when not logged in
61 * Bug Fix: #4471 Notification Checkbox Won't Stay Checked (hour roll over error)
62 * Bug Fix: Phone numbers in voicemails wouldn't appear
63 * Bug Fix: category for Fremantle/Diablo
64 * Bug Fix: needing to manually create "~/.dialcentral" due to earlier logging changes
65 * Bug Fix: dependencies for fremantle
66 * Bug Fix: Issues when trying to stack error messages
67 * Bug Fix: Python2.6 deprecates some stuff I did
68 * Bug Fix: On refreshing the Accounts tab, the callback number resets to the number from startup
69
70 1.0.5
71 * Contacts Tab remembers the last address book viewed on restart
72 * Applied some suggested changes for being more thumb friendly
73 * Messaging Dialog auto-scrolls to bottom
74 * Removed GrandCentral support
75 * Numbers can now be entered immediately, before login
76 * Bug Fix: Not clearing the entered number on sending an SMS
77 * Bug Fix: Disabling SMS button when logged off
78 * Bug Fix: Trying to make SMS and phone selection dialogs more readable
79 * Bug Fix: Adding some more thumb scrollbars
80
81 1.0.4
82 * "Back" button and tabs now visually indicate when they've entered a "hold" state
83 * Fixed the duplicate title on Maemo
84 * Removing some device connection observer code due to high bug to low benefit ratio
85 * Notification support
86 * Fixed a bug from 1.0.3 where once you refreshed a tab by holding on it, every tab would then be forced to refresh
87
88 1.0.3
89 * Holding down a tab for a second will now force a refresh
90 * Fixed a bug dealing with overzealously refreshing the contacts tab
91 * Finding some undescriptive errors and made them more descriptive
92 * Swapped the order GrandCentral and GoogleVoice appear in login window
93 * Fixed the "Recent" and "Message" tabs, google changed things on me again
94
95 1.0.2
96 * Random bug fixes
97 * Random performance improvements
98
99 1.0.1
100 * Fixed a voicemail transcripts due to a GoogleVoice change
101
102 1.0.0
103 * Added names to the recent tab for GoogleVoice
104
105 0.9.9
106 * SMS From Dialpad
107 * Display of names for messages tab
108 * Condensed messages/recent's date column
109
110 0.9.8
111  * Added columns to recent view and messages view to help seperate messages
112  * Attempted refreshing session on dial/sms send
113  * Fixed a GC Bug
114  * Minor bug fixes as usual
115
116 0.9.7
117  * Switched to Force Refresh for when wanting to check for more messages
118  * Removed timeouts that forced refreshes on various tabs
119  * Added support for a settings file, fairly primitive right now
120  * Fixed Maemo Support
121  * Lots of major and minor bug fixes
122
123 0.9.6
124  * Experimenting with the tabs being on the side
125  * Now the phone selector is used always, even if there is just one phone number
126  * Added a Messages Tab, which displays SMS and Voicemail messages
127  * Added option to send SMS messages
128
129 0.9.5
130  * Fixed a login issue due to Google changing their webpage
131
132 0.9.4 - ""
133  * Misc Bug fixes and experiments
134
135 0.9.3 - ""
136  * Removed the much disliked contact source ID
137  * Added saving of callback number when using GoogleVoice
138  * Got proper formatting on things ("&" rather than "&")
139  * Misc Bug fixes
140
141 0.9.2 - "Two heads are better than one"
142  * Adding of UI to switch between GC and GV
143  * Minimized flashing the dial button between grayed out and not on startup
144  * Bug fixes
145
146 0.9.1 - "Get your hands off that"
147  * GoogleVoice Support, what a pain
148  * More flexible CSV support.  It now checks the header row for what column name/number are in
149  * Experimenting with faster startup by caching PYC files with the package
150  * Fixing of some bad error handling
151  * More debug output for when people run into issues
152
153 0.9.0 - "Slick as snot"
154  * Caching of contacts
155  * Refactoring to make working with the code easier
156  * Filesystem backed contacts but currently only supporting a specific csv format
157  * Gracefully handle lack of connection and connection transitions
158  * Gracefully handle failed login
159  * A tiny bit better error reporting
160
161 0.8.3 - "Extras Love"
162  * Version bump fighting the extras autobuilder, I hope this works
163
164 0.8.2 - "Feed is for horses, so what about feedback?"
165  * Merged addressbook
166  * many more smaller fixes
167
168 0.8.1 - "Two Beers"
169  * Thumb scrollbars ( Kudos Khertan )
170
171 0.8.0 - "Spit and polish"
172  * Addressbook support
173  * threaded networking for better interactivity
174  * Hold down back to clear number
175  * Standard about dialog
176  * many more smaller fixes
177 """
178
179
180 __postinstall__ = """#!/bin/sh -e
181
182 gtk-update-icon-cache -f /usr/share/icons/hicolor
183 """
184
185 __preremove__ = """#!/bin/sh -e
186
187 python /usr/lib/dialcentral/alarm_handler.py -d || true
188 """
189
190
191 def find_files(path):
192         for root, dirs, files in os.walk(path):
193                 for file in files:
194                         if file.startswith("src-"):
195                                 fileParts = file.split("-")
196                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
197                                 assert unused == "src"
198                                 relPath = os.sep.join(relPathParts)
199                                 yield relPath, file, newName
200
201
202 def unflatten_files(files):
203         d = {}
204         for relPath, oldName, newName in files:
205                 if relPath not in d:
206                         d[relPath] = []
207                 d[relPath].append((oldName, newName))
208         return d
209
210
211 def build_package(distribution):
212         try:
213                 os.chdir(os.path.dirname(sys.argv[0]))
214         except:
215                 pass
216
217         py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
218         p = py2deb.Py2deb(__appname__)
219         p.description = __description__
220         p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
221         p.author = __author__
222         p.mail = __email__
223         p.license = "lgpl"
224         p.depends = ", ".join([
225                 "python2.6 | python2.5",
226                 "python-gtk2 | python2.5-gtk2",
227                 "python-xml | python2.5-xml",
228                 "python-dbus | python2.5-dbus",
229         ])
230         maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"
231         p.depends += {
232                 "debian": ", python-glade2",
233                 "chinook": maemoSpecificDepends,
234                 "diablo": maemoSpecificDepends,
235                 "fremantle": maemoSpecificDepends + ", python-glade2",
236                 "mer": maemoSpecificDepends + ", python-glade2",
237         }[distribution]
238         p.recommends = ", ".join([
239         ])
240         p.section = {
241                 "debian": "comm",
242                 "chinook": "communication",
243                 "diablo": "user/network",
244                 "fremantle": "user/network",
245                 "mer": "user/network",
246         }[distribution]
247         p.arch = "all"
248         p.urgency = "low"
249         p.distribution = "chinook diablo fremantle mer debian"
250         p.repository = "extras"
251         p.changelog = __changelog__
252         p.postinstall = __postinstall__
253         p.preremove = __preremove__
254         p.icon = {
255                 "debian": "26x26-dialcentral.png",
256                 "chinook": "26x26-dialcentral.png",
257                 "diablo": "26x26-dialcentral.png",
258                 "fremantle": "64x64-dialcentral.png", # Fremantle natively uses 48x48
259                 "mer": "64x64-dialcentral.png",
260         }[distribution]
261         p["/usr/bin"] = [ "dialcentral.py" ]
262         for relPath, files in unflatten_files(find_files(".")).iteritems():
263                 fullPath = "/usr/lib/dialcentral"
264                 if relPath:
265                         fullPath += os.sep+relPath
266                 p[fullPath] = list(
267                         "|".join((oldName, newName))
268                         for (oldName, newName) in files
269                 )
270         p["/usr/share/applications/hildon"] = ["dialcentral.desktop"]
271         p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-dialcentral.png|dialcentral.png"]
272         p["/usr/share/icons/hicolor/64x64/hildon"] = ["64x64-dialcentral.png|dialcentral.png"]
273         p["/usr/share/icons/hicolor/scalable/hildon"] = ["scale-dialcentral.png|dialcentral.png"]
274
275         print p
276         print p.generate(
277                 version="%s-%s" % (__version__, __build__),
278                 changelog=__changelog__,
279                 build=False,
280                 tar=True,
281                 changes=True,
282                 dsc=True,
283         )
284         print "Building for %s finished" % distribution
285
286
287 if __name__ == "__main__":
288         if len(sys.argv) > 1:
289                 try:
290                         import optparse
291                 except ImportError:
292                         optparse = None
293
294                 if optparse is not None:
295                         parser = optparse.OptionParser()
296                         (commandOptions, commandArgs) = parser.parse_args()
297         else:
298                 commandArgs = None
299                 commandArgs = ["diablo"]
300         build_package(commandArgs[0])