Bump to 0.8.22
[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
19 .
20 * Initiate Google Voice callbacks from the dialpad or your contacts
21 .
22 * Access to all of your Google Voice contacts
23 .
24 * Reduce battery drain by setting your status to "Away"
25 .
26 Note: Google and Google Voice are probably trademarks of Google.  This software nor the author has any affiliation with Google
27 .
28 Homepage: http://theonering.garage.maemo.org
29 """
30 __author__ = "Ed Page"
31 __email__ = "eopage@byu.net"
32 __version__ = constants.__version__
33 __build__ = constants.__build__
34 __changelog__ = """
35 * Making "calls" end immediately rather than waiting for the callback request to complete to fix issues with the waiting blocking accepting the callback if it comes in too quickly.  Reporting errors through the debug prompt now.
36 * Respecting the servers "read" status for voicemail
37 * Using a newer contacts "API" which should speed things up a big (more improvements possible)
38 """.strip()
39
40
41 __postinstall__ = """#!/bin/sh -e
42
43 gtk-update-icon-cache -f /usr/share/icons/hicolor
44 rm -f ~/.telepathy-theonering/theonering.log
45 """
46
47 def find_files(path):
48         for root, dirs, files in os.walk(path):
49                 for file in files:
50                         if file.startswith("src!"):
51                                 fileParts = file.split("!")
52                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
53                                 assert unused == "src"
54                                 relPath = os.sep.join(relPathParts)
55                                 yield relPath, file, newName
56
57
58 def unflatten_files(files):
59         d = {}
60         for relPath, oldName, newName in files:
61                 if relPath not in d:
62                         d[relPath] = []
63                 d[relPath].append((oldName, newName))
64         return d
65
66
67 def build_package(distribution):
68         try:
69                 os.chdir(os.path.dirname(sys.argv[0]))
70         except:
71                 pass
72
73         py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
74         p = py2deb.Py2deb(__appname__)
75         if distribution == "debian":
76                 p.prettyName = constants.__pretty_app_name__
77         else:
78                 p.prettyName = "Google Voice plugin for Conversations and Calls"
79         p.description = __description__
80         p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=The%%20One%%20Ring"
81         #p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
82         p.author = __author__
83         p.mail = __email__
84         p.license = "lgpl"
85         p.section = {
86                 "debian": "comm",
87                 "diablo": "user/network",
88                 "fremantle": "user/network",
89         }[distribution]
90         p.depends = ", ".join([
91                 "python (>= 2.5) | python2.5",
92                 "python-dbus | python2.5-dbus",
93                 "python-gobject | python2.5-gobject",
94                 "python-telepathy | python2.5-telepathy",
95         ])
96         p.depends += {
97                 "debian": "",
98                 "diablo": ", python2.5-conic, account-plugin-haze",
99                 "fremantle": ", account-plugin-haze",
100         }[distribution]
101         p.arch = "all"
102         p.urgency = "low"
103         p.distribution = "diablo fremantle debian"
104         p.repository = "extras"
105         p.changelog = __changelog__
106         p.postinstall = __postinstall__
107         p.icon = "32-tor_handset.png"
108         for relPath, files in unflatten_files(find_files(".")).iteritems():
109                 fullPath = "/opt/theonering/lib"
110                 if relPath:
111                         fullPath += os.sep+relPath
112                 p[fullPath] = list(
113                         "|".join((oldName, newName))
114                         for (oldName, newName) in files
115                 )
116         p["/usr/share/dbus-1/services"] = ["org.freedesktop.Telepathy.ConnectionManager.theonering.service"]
117         if distribution in ("debian", ):
118                 p["/usr/share/mission-control/profiles"] = ["theonering.profile.%s|theonering.profile"% distribution]
119         elif distribution in ("diablo", "fremantle"):
120                 p["/usr/share/osso-rtcom"] = ["theonering.profile.%s|theonering.profile"% distribution]
121         p["/usr/lib/telepathy"] = ["telepathy-theonering"]
122         p["/usr/share/telepathy/managers"] = ["theonering.manager"]
123         if distribution in ("debian", ):
124                 iconBasePath = "/usr/share/icons/gnome/%s/apps"
125         elif distribution in ("diablo", "fremantle"):
126                 iconBasePath = "/usr/share/icons/hicolor/%s/hildon"
127         p[iconBasePath % "26x26"] = ["26-tor_handset.png|im-theonering.png"]
128         p[iconBasePath % "32x32"] = ["32-tor_handset.png|im-theonering.png"]
129         p[iconBasePath % "64x64"] = ["64-tor_handset.png|im-theonering.png"]
130         p["/opt/theonering/share"] = [
131                 "32-tor_handset.png|tor_handset.png",
132                 "32-tor_phone.png|tor_phone.png",
133                 "32-tor_question.png|tor_question.png",
134                 "32-tor_self.png|tor_self.png",
135         ]
136
137         if distribution == "debian":
138                 print p
139                 print p.generate(
140                         version="%s-%s" % (__version__, __build__),
141                         changelog=__changelog__,
142                         build=True,
143                         tar=False,
144                         changes=False,
145                         dsc=False,
146                 )
147                 print "Building for %s finished" % distribution
148         else:
149                 print p
150                 print p.generate(
151                         version="%s-%s" % (__version__, __build__),
152                         changelog=__changelog__,
153                         build=False,
154                         tar=True,
155                         changes=True,
156                         dsc=True,
157                 )
158                 print "Building for %s finished" % distribution
159
160
161 if __name__ == "__main__":
162         if len(sys.argv) > 1:
163                 try:
164                         import optparse
165                 except ImportError:
166                         optparse = None
167
168                 if optparse is not None:
169                         parser = optparse.OptionParser()
170                         (commandOptions, commandArgs) = parser.parse_args()
171         else:
172                 commandArgs = None
173                 commandArgs = ["diablo"]
174         build_package(commandArgs[0])