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