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