Fixing a -T polling bug
[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.4
38 * Fixing a bug with deny-lists
39
40 0.7.3
41 * Fixing bug with being able to configure polling times
42
43 0.7.2
44 * Added a Deny list
45 * Added option to make GV Contacts optional
46 * Added a limit, where if a state machine period is longer than it, than we set the period to infinite
47 * Delayed when we say the connection is disconnected to hopefully help random issues
48 * Tweaked how The One Ring shows up in the addressbook (Maemo 5)
49 * Made polling configurable
50 * Delayed auto-disconnect in case the user is just switching network connections (Maemo 4.1)
51 * Bugfix: Removed superfluous blank message from debug prompt
52 * Bugfix: Moved some more (very minor, very rarely used) timeouts to second resolution reducing overhead
53 * Bugfix: debug prompt commands handled command validation poorly
54 * Debug Prompt: Added a "version" command
55 * Debug Prompt: Added a "get_polling" command to find out what the actual polling periods are
56 * Debug Prompt: Added a "grab_log" command which is a broken but means to offer the log file through a file transfer
57 * Debug Prompt: Added a "save_log" command to help till grab_log works and for where file transfers aren't supported by clients
58
59 0.7.1
60 * Reducing the race window where GV will mark messages as read accidently
61 * Modified some things blindly "because thats what Butterfly does"
62 * Modified some support files to mimic other plugins on Maemo 5 PR1.1
63 * Added link to bug tracker and moved all bugs and enhancements to it
64 * Switched contacts to being away by default upon user feedback
65 * Adjusting handling of call states to at least allow the option of clients to provide clearer information to the user
66 * Fixing some bugs with handling a variety of phone number formats
67 * Removed a hack that changed the number being called, most likely put in place in a bygone era
68
69 0.7.0
70 * Initial beta release for Maemo 5
71 * Late Alpha for Maemo 4.1 with horrible consequences like crashing RTComm
72
73 0.1.0
74 * Pre-Alpha Development Release
75 """
76
77
78 __postinstall__ = """#!/bin/sh -e
79
80 gtk-update-icon-cache -f /usr/share/icons/hicolor
81 rm -f ~/.telepathy-theonering/theonering.log
82 """
83
84 def find_files(path):
85         for root, dirs, files in os.walk(path):
86                 for file in files:
87                         if file.startswith("src!"):
88                                 fileParts = file.split("!")
89                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
90                                 assert unused == "src"
91                                 relPath = os.sep.join(relPathParts)
92                                 yield relPath, file, newName
93
94
95 def unflatten_files(files):
96         d = {}
97         for relPath, oldName, newName in files:
98                 if relPath not in d:
99                         d[relPath] = []
100                 d[relPath].append((oldName, newName))
101         return d
102
103
104 def build_package(distribution):
105         try:
106                 os.chdir(os.path.dirname(sys.argv[0]))
107         except:
108                 pass
109
110         py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
111         p = py2deb.Py2deb(__appname__)
112         if distribution == "debian":
113                 p.prettyName = constants.__pretty_app_name__
114         else:
115                 p.prettyName = "Google Voice plugin for Conversations and Calls"
116         p.description = __description__
117         p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=The%%20One%%20Ring"
118         #p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
119         p.author = __author__
120         p.mail = __email__
121         p.license = "lgpl"
122         p.section = {
123                 "debian": "comm",
124                 "diablo": "user/network",
125                 "fremantle": "user/network",
126                 "mer": "user/network",
127         }[distribution]
128         p.depends = ", ".join([
129                 "python (>= 2.5) | python2.5",
130                 "python-dbus | python2.5-dbus",
131                 "python-gobject | python2.5-gobject",
132                 "python-telepathy | python2.5-telepathy",
133         ])
134         p.depends += {
135                 "debian": "",
136                 "diablo": ", python2.5-conic, account-plugin-haze",
137                 "fremantle": ", account-plugin-haze",
138                 "mer": "",
139         }[distribution]
140         p.arch = "all"
141         p.urgency = "low"
142         p.distribution = "diablo fremantle mer debian"
143         p.repository = "extras"
144         p.changelog = __changelog__
145         p.postinstall = __postinstall__
146         p.icon = {
147                 "debian": "26x26-theonering.png",
148                 "diablo": "26x26-theonering.png",
149                 "fremantle": "64x64-theonering.png", # Fremantle natively uses 48x48
150                 "mer": "64x64-theonering.png",
151         }[distribution]
152         for relPath, files in unflatten_files(find_files(".")).iteritems():
153                 fullPath = "/usr/lib/theonering"
154                 if relPath:
155                         fullPath += os.sep+relPath
156                 p[fullPath] = list(
157                         "|".join((oldName, newName))
158                         for (oldName, newName) in files
159                 )
160         p["/usr/share/dbus-1/services"] = ["org.freedesktop.Telepathy.ConnectionManager.theonering.service"]
161         if distribution in ("debian", ):
162                 p["/usr/share/mission-control/profiles"] = ["theonering.profile.%s|theonering.profile"% distribution]
163         elif distribution in ("diablo", "fremantle", "mer"):
164                 p["/usr/share/osso-rtcom"] = ["theonering.profile.%s|theonering.profile"% distribution]
165         p["/usr/lib/telepathy"] = ["telepathy-theonering"]
166         p["/usr/share/telepathy/managers"] = ["theonering.manager"]
167         p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-theonering.png|im-theonering.png"]
168
169         if distribution == "debian":
170                 print p
171                 print p.generate(
172                         version="%s-%s" % (__version__, __build__),
173                         changelog=__changelog__,
174                         build=True,
175                         tar=False,
176                         changes=False,
177                         dsc=False,
178                 )
179                 print "Building for %s finished" % distribution
180         else:
181                 print p
182                 print p.generate(
183                         version="%s-%s" % (__version__, __build__),
184                         changelog=__changelog__,
185                         build=False,
186                         tar=True,
187                         changes=True,
188                         dsc=True,
189                 )
190                 print "Building for %s finished" % distribution
191
192
193 if __name__ == "__main__":
194         if len(sys.argv) > 1:
195                 try:
196                         import optparse
197                 except ImportError:
198                         optparse = None
199
200                 if optparse is not None:
201                         parser = optparse.OptionParser()
202                         (commandOptions, commandArgs) = parser.parse_args()
203         else:
204                 commandArgs = None
205                 commandArgs = ["diablo"]
206         build_package(commandArgs[0])