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