Renaming the icon to be autodetected by new empathy
[theonering] / 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__ = """Send/receive texts and initiate GV callbacks all through Conversations and Phone
16 Features:
17 .
18 * Send Texts and Receive both Texts and Voicemail through your chat window (buggy on Maemo 4.1)
19 .
20 * Initiate Google Voice callbacks from the dialpad or your contacts
21 .
22 * Access to all of your Google Voice contacts (Maemo 4.1 only for now)
23 .
24 * Reduce battery drain by setting your status to "Away"
25 .
26 * Block incoming calls by switching your status to "Hidden"
27 .
28 Note: Google and Google Voice are probably trademarks of Google.  This software nor the author has any affiliation with Google
29 .
30 Homepage: http://theonering.garage.maemo.org
31 """
32 __author__ = "Ed Page"
33 __email__ = "eopage@byu.net"
34 __version__ = constants.__version__
35 __build__ = constants.__build__
36 __changelog__ = """
37 0.8.3
38 * "Hold" support for calls, so that initiating a callback does not block incoming calls
39 * Increased the auto-cleanup timeout from 5 seconds to 10 seconds
40
41 0.8.2
42 * Improved debug logs, removing noise
43 * Reduced allotted disconnect time from 5 seconds to 2
44 * Auto-cleanup resources when client only does phase 1 of 2 connection creation phases
45 * Added 26x26 and 64x64 variants of icons to hopefully fix issues on Maemo 4.1
46
47 0.8.1
48 * Canceling of outbound calls
49 * Bugfix: Removing race condition with disconnect.  I introduced it expecting it to help but it hurts more than it helps
50
51 0.8.0
52 * Basic avatar support to distinguish phone types
53 * Tweaks to hopefully improve behavior
54
55 0.7.14
56 * Bugfix: Polling state machines weren't properly resetting (maybe thats why I had such good battery life)
57 * Bugfix: On Maemo 4.1 there are still some empty windows created
58 * Bugfix: Obscure alias bug no one should hit with The One Ring
59 * Bugfix: Another obscure bug causing possibly no negative side-effects
60
61 0.7.13
62 * Bugfix: Cancelling timeouts
63
64 0.7.12
65 * Bugfix: In 0.7.11 I messed up refreshing messages
66 * Bugfix: DND support has been broken for a while
67 * Bugfix: Auto-disconnect on Maemo 4.1 couldn't have worked for a while
68 * Bugfix: Handling missed calls had .. issues
69 * Bugfix: Issues when making a call introduced in 0.7.11
70 * Etc with the bug fixes (all too small to list)
71
72 0.7.11
73 * Bugfix: Attempting to improve the behavior of calls by reducing potential RTComm errors
74 * Bugfix: Issues with weird unexpected disconnect issues
75 * Bugfix: I guess I made a mistake in registering for system signals, whoops
76 * Bugfix: Following more closely the Telepathy spec by doing connects and disconnects asynchronously
77
78 0.7.10
79 * Increased the network timeout when connecting to GV
80 * Bugfix: On connection failure, the connection would be left around, preventing future connections
81
82 0.7.9
83 * Bugfix: Disconnect/Reconnect issues seem to be lessoned for me (What I previously thought was a bugfix turned out to cause several bugs.)
84
85 0.7.8
86 * Bugfix: Issues with checking for new conversations
87
88 0.7.7
89 * On change between available/away, start state_machine at max rather than min, reducing overhead
90 * Added a check for voicemails on missed/rejected calls (checks 3 times, 1 minute apart each)
91 * Adjusted default polling times to be more battery cautious for our n8x0 friends who can't change things right now
92 * Bugfix: Some of the derived polling settings had bugs
93 * Bugfix: Setting text polling to infinite would still have polling done if one sent a text
94
95 0.7.6
96 * On login, polling now starts at the max time rather than the min, reducing overhead
97 * Bugfix: Polling configuration wasn't actually hooked up to anything
98 * Debug Prompt: Made it so you can either reset one or all state machines (Rather than just all)
99
100 0.7.5
101 * Fixing a polling time bug introduced when making polling configurable
102
103 0.7.4
104 * Fixing a bug with deny-lists
105
106 0.7.3
107 * Fixing bug with being able to configure polling times
108
109 0.7.2
110 * Added a Deny list
111 * Added option to make GV Contacts optional
112 * Added a limit, where if a state machine period is longer than it, than we set the period to infinite
113 * Delayed when we say the connection is disconnected to hopefully help random issues
114 * Tweaked how The One Ring shows up in the addressbook (Maemo 5)
115 * Made polling configurable
116 * Delayed auto-disconnect in case the user is just switching network connections (Maemo 4.1)
117 * Bugfix: Removed superfluous blank message from debug prompt
118 * Bugfix: Moved some more (very minor, very rarely used) timeouts to second resolution reducing overhead
119 * Bugfix: debug prompt commands handled command validation poorly
120 * Debug Prompt: Added a "version" command
121 * Debug Prompt: Added a "get_polling" command to find out what the actual polling periods are
122 * Debug Prompt: Added a "grab_log" command which is a broken but means to offer the log file through a file transfer
123 * Debug Prompt: Added a "save_log" command to help till grab_log works and for where file transfers aren't supported by clients
124
125 0.7.1
126 * Reducing the race window where GV will mark messages as read accidently
127 * Modified some things blindly "because thats what Butterfly does"
128 * Modified some support files to mimic other plugins on Maemo 5 PR1.1
129 * Added link to bug tracker and moved all bugs and enhancements to it
130 * Switched contacts to being away by default upon user feedback
131 * Adjusting handling of call states to at least allow the option of clients to provide clearer information to the user
132 * Fixing some bugs with handling a variety of phone number formats
133 * Removed a hack that changed the number being called, most likely put in place in a bygone era
134
135 0.7.0
136 * Initial beta release for Maemo 5
137 * Late Alpha for Maemo 4.1 with horrible consequences like crashing RTComm
138
139 0.1.0
140 * Pre-Alpha Development Release
141 """
142
143
144 __postinstall__ = """#!/bin/sh -e
145
146 gtk-update-icon-cache -f /usr/share/icons/hicolor
147 rm -f ~/.telepathy-theonering/theonering.log
148 """
149
150 def find_files(path):
151         for root, dirs, files in os.walk(path):
152                 for file in files:
153                         if file.startswith("src!"):
154                                 fileParts = file.split("!")
155                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
156                                 assert unused == "src"
157                                 relPath = os.sep.join(relPathParts)
158                                 yield relPath, file, newName
159
160
161 def unflatten_files(files):
162         d = {}
163         for relPath, oldName, newName in files:
164                 if relPath not in d:
165                         d[relPath] = []
166                 d[relPath].append((oldName, newName))
167         return d
168
169
170 def build_package(distribution):
171         try:
172                 os.chdir(os.path.dirname(sys.argv[0]))
173         except:
174                 pass
175
176         py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
177         p = py2deb.Py2deb(__appname__)
178         if distribution == "debian":
179                 p.prettyName = constants.__pretty_app_name__
180         else:
181                 p.prettyName = "Google Voice plugin for Conversations and Calls"
182         p.description = __description__
183         p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=The%%20One%%20Ring"
184         #p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
185         p.author = __author__
186         p.mail = __email__
187         p.license = "lgpl"
188         p.section = {
189                 "debian": "comm",
190                 "diablo": "user/network",
191                 "fremantle": "user/network",
192                 "mer": "user/network",
193         }[distribution]
194         p.depends = ", ".join([
195                 "python (>= 2.5) | python2.5",
196                 "python-dbus | python2.5-dbus",
197                 "python-gobject | python2.5-gobject",
198                 "python-telepathy | python2.5-telepathy",
199         ])
200         p.depends += {
201                 "debian": "",
202                 "diablo": ", python2.5-conic, account-plugin-haze",
203                 "fremantle": ", account-plugin-haze",
204                 "mer": "",
205         }[distribution]
206         p.arch = "all"
207         p.urgency = "low"
208         p.distribution = "diablo fremantle mer debian"
209         p.repository = "extras"
210         p.changelog = __changelog__
211         p.postinstall = __postinstall__
212         p.icon = "32-tor_handset.png"
213         for relPath, files in unflatten_files(find_files(".")).iteritems():
214                 fullPath = "/usr/lib/theonering"
215                 if relPath:
216                         fullPath += os.sep+relPath
217                 p[fullPath] = list(
218                         "|".join((oldName, newName))
219                         for (oldName, newName) in files
220                 )
221         p["/usr/share/dbus-1/services"] = ["org.freedesktop.Telepathy.ConnectionManager.theonering.service"]
222         if distribution in ("debian", ):
223                 p["/usr/share/mission-control/profiles"] = ["theonering.profile.%s|theonering.profile"% distribution]
224         elif distribution in ("diablo", "fremantle", "mer"):
225                 p["/usr/share/osso-rtcom"] = ["theonering.profile.%s|theonering.profile"% distribution]
226         p["/usr/lib/telepathy"] = ["telepathy-theonering"]
227         p["/usr/share/telepathy/managers"] = ["theonering.manager"]
228         p["/usr/share/icons/hicolor/26x26/hildon"] = ["26-tor_handset.png|im-theonering.png"]
229         p["/usr/share/icons/hicolor/32x32/hildon"] = ["32-tor_handset.png|im-theonering.png"]
230         p["/usr/share/icons/hicolor/64x64/hildon"] = ["64-tor_handset.png|im-theonering.png"]
231         p["/usr/share/theonering"] = [
232                 "32-tor_handset.png|tor_handset.png",
233                 "32-tor_phone.png|tor_phone.png",
234                 "32-tor_question.png|tor_question.png",
235                 "32-tor_self.png|tor_self.png",
236         ]
237
238         if distribution == "debian":
239                 print p
240                 print p.generate(
241                         version="%s-%s" % (__version__, __build__),
242                         changelog=__changelog__,
243                         build=True,
244                         tar=False,
245                         changes=False,
246                         dsc=False,
247                 )
248                 print "Building for %s finished" % distribution
249         else:
250                 print p
251                 print p.generate(
252                         version="%s-%s" % (__version__, __build__),
253                         changelog=__changelog__,
254                         build=False,
255                         tar=True,
256                         changes=True,
257                         dsc=True,
258                 )
259                 print "Building for %s finished" % distribution
260
261
262 if __name__ == "__main__":
263         if len(sys.argv) > 1:
264                 try:
265                         import optparse
266                 except ImportError:
267                         optparse = None
268
269                 if optparse is not None:
270                         parser = optparse.OptionParser()
271                         (commandOptions, commandArgs) = parser.parse_args()
272         else:
273                 commandArgs = None
274                 commandArgs = ["diablo"]
275         build_package(commandArgs[0])