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