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