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