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