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