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