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