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