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