Bump to 0.8.13
[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 * Speed up: login through cookies
38 * Speed up: by default TOR disallows DND.  When DND is allowed TOR will not do duplicate work now
39 * Adjusted the timeout for hung connections
40 * Allowing longer phone calls to kick off a voicemail check (accounted for rejected but not ignored calls originally)
41 * Lengthened auto-disconnect from 20-60 seconds
42 * Imitating telepathy-butterfly in some changes that have been made
43 * Reduced some log noise
44 * Optified
45 """.strip()
46
47
48 __postinstall__ = """#!/bin/sh -e
49
50 gtk-update-icon-cache -f /usr/share/icons/hicolor
51 rm -f ~/.telepathy-theonering/theonering.log
52 """
53
54 def find_files(path):
55         for root, dirs, files in os.walk(path):
56                 for file in files:
57                         if file.startswith("src!"):
58                                 fileParts = file.split("!")
59                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
60                                 assert unused == "src"
61                                 relPath = os.sep.join(relPathParts)
62                                 yield relPath, file, newName
63
64
65 def unflatten_files(files):
66         d = {}
67         for relPath, oldName, newName in files:
68                 if relPath not in d:
69                         d[relPath] = []
70                 d[relPath].append((oldName, newName))
71         return d
72
73
74 def build_package(distribution):
75         try:
76                 os.chdir(os.path.dirname(sys.argv[0]))
77         except:
78                 pass
79
80         py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
81         p = py2deb.Py2deb(__appname__)
82         if distribution == "debian":
83                 p.prettyName = constants.__pretty_app_name__
84         else:
85                 p.prettyName = "Google Voice plugin for Conversations and Calls"
86         p.description = __description__
87         p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=The%%20One%%20Ring"
88         #p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
89         p.author = __author__
90         p.mail = __email__
91         p.license = "lgpl"
92         p.section = {
93                 "debian": "comm",
94                 "diablo": "user/network",
95                 "fremantle": "user/network",
96         }[distribution]
97         p.depends = ", ".join([
98                 "python (>= 2.5) | python2.5",
99                 "python-dbus | python2.5-dbus",
100                 "python-gobject | python2.5-gobject",
101                 "python-telepathy | python2.5-telepathy",
102         ])
103         p.depends += {
104                 "debian": "",
105                 "diablo": ", python2.5-conic, account-plugin-haze",
106                 "fremantle": ", account-plugin-haze",
107         }[distribution]
108         p.arch = "all"
109         p.urgency = "low"
110         p.distribution = "diablo fremantle debian"
111         p.repository = "extras"
112         p.changelog = __changelog__
113         p.postinstall = __postinstall__
114         p.icon = "32-tor_handset.png"
115         for relPath, files in unflatten_files(find_files(".")).iteritems():
116                 fullPath = "/opt/theonering/lib"
117                 if relPath:
118                         fullPath += os.sep+relPath
119                 p[fullPath] = list(
120                         "|".join((oldName, newName))
121                         for (oldName, newName) in files
122                 )
123         p["/usr/share/dbus-1/services"] = ["org.freedesktop.Telepathy.ConnectionManager.theonering.service"]
124         if distribution in ("debian", ):
125                 p["/usr/share/mission-control/profiles"] = ["theonering.profile.%s|theonering.profile"% distribution]
126         elif distribution in ("diablo", "fremantle"):
127                 p["/usr/share/osso-rtcom"] = ["theonering.profile.%s|theonering.profile"% distribution]
128         p["/opt/theonering/bin"] = ["telepathy-theonering"]
129         p["/usr/share/telepathy/managers"] = ["theonering.manager"]
130         if distribution in ("debian", ):
131                 iconBasePath = "/usr/share/icons/gnome/%s/apps"
132         elif distribution in ("diablo", "fremantle"):
133                 iconBasePath = "/usr/share/icons/hicolor/%s/hildon"
134         p[iconBasePath % "26x26"] = ["26-tor_handset.png|im-theonering.png"]
135         p[iconBasePath % "32x32"] = ["32-tor_handset.png|im-theonering.png"]
136         p[iconBasePath % "64x64"] = ["64-tor_handset.png|im-theonering.png"]
137         p["/opt/theonering/share"] = [
138                 "32-tor_handset.png|tor_handset.png",
139                 "32-tor_phone.png|tor_phone.png",
140                 "32-tor_question.png|tor_question.png",
141                 "32-tor_self.png|tor_self.png",
142         ]
143
144         if distribution == "debian":
145                 print p
146                 print p.generate(
147                         version="%s-%s" % (__version__, __build__),
148                         changelog=__changelog__,
149                         build=True,
150                         tar=False,
151                         changes=False,
152                         dsc=False,
153                 )
154                 print "Building for %s finished" % distribution
155         else:
156                 print p
157                 print p.generate(
158                         version="%s-%s" % (__version__, __build__),
159                         changelog=__changelog__,
160                         build=False,
161                         tar=True,
162                         changes=True,
163                         dsc=True,
164                 )
165                 print "Building for %s finished" % distribution
166
167
168 if __name__ == "__main__":
169         if len(sys.argv) > 1:
170                 try:
171                         import optparse
172                 except ImportError:
173                         optparse = None
174
175                 if optparse is not None:
176                         parser = optparse.OptionParser()
177                         (commandOptions, commandArgs) = parser.parse_args()
178         else:
179                 commandArgs = None
180                 commandArgs = ["diablo"]
181         build_package(commandArgs[0])