Status: | Merged |
---|---|
Approved by: | Didier Roche-Tolomelli |
Approved revision: | 692 |
Merged at revision: | 685 |
Proposed branch: | lp:~mterry/quickly/arb |
Merge into: | lp:quickly |
Prerequisite: | lp:~mterry/quickly/overwrite |
Diff against target: |
442 lines (+84/-135) 16 files modified
data/templates/ubuntu-application/help/tutorial.xml (+1/-1) data/templates/ubuntu-application/internal/packaging.py (+0/-92) data/templates/ubuntu-application/project_root/bin/project_name (+4/-3) data/templates/ubuntu-application/project_root/python/Aboutcamel_case_nameDialog.py (+1/-3) data/templates/ubuntu-application/project_root/python/Preferencescamel_case_nameDialog.py (+1/-3) data/templates/ubuntu-application/project_root/python/__init__.py (+1/-3) data/templates/ubuntu-application/project_root/python/camel_case_nameWindow.py (+1/-3) data/templates/ubuntu-application/project_root/python_lib/helpers.py (+1/-3) data/templates/ubuntu-application/project_root/python_lib/python_nameconfig.py (+1/-3) data/templates/ubuntu-application/project_root/setup.py (+54/-10) data/templates/ubuntu-application/test/extras.sh (+5/-3) data/templates/ubuntu-application/upgrade.py (+10/-0) data/templates/ubuntu-cli/project_root/python/__init__.py (+1/-3) data/templates/ubuntu-cli/project_root/python/python_nameconfig.py (+1/-3) quickly/quicklyconfig.py (+1/-1) setup.py (+1/-1) |
To merge this branch: | bzr merge lp:~mterry/quickly/arb |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Didier Roche-Tolomelli | Approve | ||
Review via email: mp+118079@code.launchpad.net |
Commit message
Description of the change
This branch lets us drop all the craziness I put into debian/rules for --extras packages. We put those there because for the SRU, we wanted to reduce the surface of the changes.
But now we can put them back into the user bin wrapper and setup.py like they should have been all along.
Note that this branch relies on the overwrite branch, so only a little bit of it (the gettext->locale stuff) needs to have explicit upgrade.py support.
- 691. By Michael Terry
-
make sure to not lose the bug fix for supporting added script arguments in desktop files
- 692. By Michael Terry
-
provide correct default for XDG_DATA_DIRS
- 693. By Michael Terry
-
merge latest overwrite branch
- 694. By Michael Terry
-
minor cleanup
Michael Terry (mterry) wrote : | # |
Thanks, dropped the accidentally included print message.
The locale version of gettext is apparently better because it supports when you've changed the localedir as we do for extras. The preference for locale was originally from a branch by dpm. I haven't seen bad side effects like utf8 errors.
Branch updated and merged my latest overwrite changes.
Preview Diff
1 | === modified file 'data/templates/ubuntu-application/help/tutorial.xml' |
2 | --- data/templates/ubuntu-application/help/tutorial.xml 2012-08-02 14:29:46 +0000 |
3 | +++ data/templates/ubuntu-application/help/tutorial.xml 2012-08-17 21:00:25 +0000 |
4 | @@ -3,7 +3,7 @@ |
5 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ |
6 | |
7 | <!ENTITY appname "<application>Quickly</application>" > |
8 | - <!ENTITY appversion "12.08" > |
9 | + <!ENTITY appversion "12.08.1" > |
10 | ] > |
11 | |
12 | <book lang="en" id="index"> |
13 | |
14 | === modified file 'data/templates/ubuntu-application/internal/packaging.py' |
15 | --- data/templates/ubuntu-application/internal/packaging.py 2012-07-09 12:16:02 +0000 |
16 | +++ data/templates/ubuntu-application/internal/packaging.py 2012-08-17 21:00:25 +0000 |
17 | @@ -159,99 +159,7 @@ |
18 | return(_continue_if_errors(err_output, warn_output, proc.returncode, |
19 | ask_on_warn_or_error)) |
20 | |
21 | - |
22 | -# TODO: Vastly simplify this function. This was implemented post-12.04 to |
23 | -# make it easier to get an SRU for these fixes. But the only things here |
24 | -# that can't be done in-code (either wrapper code or setup.py) is compiling |
25 | -# the schemas and moving the desktop file. |
26 | def update_rules(): |
27 | - project_name = configurationhandler.project_config['project'] |
28 | - |
29 | - install_rules = """ |
30 | -override_dh_install: |
31 | - dh_install""" |
32 | - |
33 | - opt_root = "/opt/extras.ubuntu.com/" + project_name |
34 | - |
35 | - # Move script to bin/ folder. |
36 | - # There are some complications here. As of this writing, current versions |
37 | - # of python-mkdebian do not correctly install our executable script in a |
38 | - # bin/ subdirectory. Instead, they either install it in the opt-project |
39 | - # root or in the opt-project python library folder (depending on whether |
40 | - # the project name is the same as its python name). So if we find that to |
41 | - # be the case, we move the script accordingly. |
42 | - bin_path = "%(opt_root)s/bin/%(project_name)s" % { |
43 | - 'opt_root': opt_root, 'project_name': project_name} |
44 | - bad_bin_debpath = "debian/%(project_name)s%(opt_root)s/%(project_name)s" % { |
45 | - 'opt_root': opt_root, 'project_name': project_name} |
46 | - python_name = templatetools.python_name(project_name) |
47 | - if project_name == python_name: |
48 | - bad_bin_debpath += "/" + project_name |
49 | - install_rules += """ |
50 | - mkdir -p debian/%(project_name)s%(opt_root)s/bin |
51 | - if [ -x %(bad_bin_debpath)s ]; then mv %(bad_bin_debpath)s debian/%(project_name)s%(opt_root)s/bin; fi""" % { |
52 | - 'project_name': project_name, 'opt_root': opt_root, 'bad_bin_debpath': bad_bin_debpath} |
53 | - |
54 | - # Move desktop file and update it to point to our /opt locations. |
55 | - # The file starts, as expected, under /opt. But the ARB wants and allows |
56 | - # us to install it in /usr, so we do. |
57 | - old_desktop_debdir = "debian/%(project_name)s%(opt_root)s/share/applications" % { |
58 | - 'project_name': project_name, 'opt_root': opt_root} |
59 | - new_desktop_debdir = "debian/%(project_name)s/usr/share/applications" % {'project_name': project_name} |
60 | - new_desktop_debpath = new_desktop_debdir + "/extras-" + project_name + ".desktop" |
61 | - install_rules += """ |
62 | - if [ -f %(old_desktop_debdir)s/%(project_name)s.desktop ]; then \\ |
63 | - mkdir -p %(new_desktop_debdir)s; \\ |
64 | - mv %(old_desktop_debdir)s/%(project_name)s.desktop %(new_desktop_debpath)s; \\ |
65 | - rmdir --ignore-fail-on-non-empty %(old_desktop_debdir)s; \\ |
66 | - sed -i 's|Exec=[^ ]*|Exec=%(bin_path)s|' %(new_desktop_debpath)s; \\ |
67 | - sed -i 's|Icon=/usr/|Icon=%(opt_root)s/|' %(new_desktop_debpath)s; \\ |
68 | - fi""" % { |
69 | - 'bin_path': bin_path, 'old_desktop_debdir': old_desktop_debdir, |
70 | - 'new_desktop_debdir': new_desktop_debdir, 'project_name': project_name, |
71 | - 'opt_root': opt_root, 'new_desktop_debpath': new_desktop_debpath} |
72 | - |
73 | - # Set gettext's bindtextdomain to point to /opt and use the locale |
74 | - # module (gettext's C API) instead of the gettext module (gettext's Python |
75 | - # API), so that translations are loaded from /opt |
76 | - localedir = os.path.join(opt_root, 'share/locale') |
77 | - install_rules += """ |
78 | - grep -RlZ 'import gettext' debian/%(project_name)s/* | xargs -0 -r sed -i 's|\(import\) gettext$$|\\1 locale|' |
79 | - grep -RlZ 'from gettext import gettext as _' debian/%(project_name)s/* | xargs -0 -r sed -i 's|from gettext \(import gettext as _\)|from locale \\1|' |
80 | - grep -RlZ "gettext.textdomain('%(project_name)s')" debian/%(project_name)s/* | xargs -0 -r sed -i "s|gettext\(\.textdomain('%(project_name)s')\)|locale\.bindtextdomain('%(project_name)s', '%(localedir)s')\\nlocale\\1|" """ % { |
81 | - 'project_name': project_name, 'localedir': localedir} |
82 | - |
83 | - # We install a python_nameconfig.py file that contains a pointer to the |
84 | - # data directory. But that will be determined by setup.py, so it will be |
85 | - # wrong (python-mkdebian's --prefix command only affects where it moves |
86 | - # files during build, but not what it passes to setup.py) |
87 | - config_debpath = "debian/%(project_name)s%(opt_root)s/%(python_name)s*/%(python_name)sconfig.py" % { |
88 | - 'project_name': project_name, 'opt_root': opt_root, 'python_name': python_name} |
89 | - install_rules += """ |
90 | - sed -i "s|__%(python_name)s_data_directory__ =.*|__%(python_name)s_data_directory__ = '%(opt_root)s/share/%(project_name)s/'|" %(config_debpath)s""" % { |
91 | - 'opt_root': opt_root, 'project_name': project_name, |
92 | - 'python_name': python_name, 'config_debpath': config_debpath} |
93 | - |
94 | - # Adjust XDG_DATA_DIRS so we can find schemas and help files |
95 | - install_rules += """ |
96 | - sed -i 's| sys.path.insert(0, opt_path)|\\0\\n os.putenv("XDG_DATA_DIRS", "%%s:%%s" %% ("%(opt_root)s/share/", os.getenv("XDG_DATA_DIRS", "")))|' debian/%(project_name)s%(bin_path)s""" % { |
97 | - 'opt_root': opt_root, 'project_name': project_name, 'bin_path': bin_path} |
98 | - |
99 | - # Compile the glib schema, since it is in a weird place that normal glib |
100 | - # triggers won't catch during package install. |
101 | - schema_debdir = "debian/%(project_name)s%(opt_root)s/share/glib-2.0/schemas" % { |
102 | - 'opt_root': opt_root, 'project_name': project_name} |
103 | - install_rules += """ |
104 | - if [ -d %(schema_debdir)s ]; then glib-compile-schemas %(schema_debdir)s; fi""" % { |
105 | - 'schema_debdir': schema_debdir} |
106 | - |
107 | - # Set rules back to include our changes |
108 | - rules = '' |
109 | - with open('debian/rules', 'r') as f: |
110 | - rules = f.read() |
111 | - rules += install_rules |
112 | - templatetools.set_file_contents('debian/rules', rules) |
113 | - |
114 | # Also update debian/control to add a new Build-Depends needed for |
115 | # glib-compile-schemas |
116 | templatetools.update_file_content( |
117 | |
118 | === modified file 'data/templates/ubuntu-application/project_root/bin/project_name' |
119 | --- data/templates/ubuntu-application/project_root/bin/project_name 2012-08-17 21:00:25 +0000 |
120 | +++ data/templates/ubuntu-application/project_root/bin/project_name 2012-08-17 21:00:25 +0000 |
121 | @@ -9,9 +9,8 @@ |
122 | import sys |
123 | import os |
124 | |
125 | -import gettext |
126 | -from gettext import gettext as _ |
127 | -gettext.textdomain('project_name') |
128 | +import locale |
129 | +locale.textdomain('project_name') |
130 | |
131 | # Add project root directory (enable symlink and trunk execution) |
132 | PROJECT_ROOT_DIRECTORY = os.path.abspath( |
133 | @@ -19,11 +18,13 @@ |
134 | |
135 | python_path = [] |
136 | if os.path.abspath(__file__).startswith('/opt'): |
137 | + locale.bindtextdomain('project_name', '/opt/extras.ubuntu.com/project_name/share/locale') |
138 | syspath = sys.path[:] # copy to avoid infinite loop in pending objects |
139 | for path in syspath: |
140 | opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/project_name') |
141 | python_path.insert(0, opt_path) |
142 | sys.path.insert(0, opt_path) |
143 | + os.putenv("XDG_DATA_DIRS", "%s:%s" % ("/opt/extras.ubuntu.com/project_name/share/", os.getenv("XDG_DATA_DIRS", "/usr/local/share/:/usr/share/"))) |
144 | if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'python_name')) |
145 | and PROJECT_ROOT_DIRECTORY not in sys.path): |
146 | python_path.insert(0, PROJECT_ROOT_DIRECTORY) |
147 | |
148 | === modified file 'data/templates/ubuntu-application/project_root/python/Aboutcamel_case_nameDialog.py' |
149 | --- data/templates/ubuntu-application/project_root/python/Aboutcamel_case_nameDialog.py 2011-04-04 14:28:36 +0000 |
150 | +++ data/templates/ubuntu-application/project_root/python/Aboutcamel_case_nameDialog.py 2012-08-17 21:00:25 +0000 |
151 | @@ -3,9 +3,7 @@ |
152 | # This file is in the public domain |
153 | ### END LICENSE |
154 | |
155 | -import gettext |
156 | -from gettext import gettext as _ |
157 | -gettext.textdomain('project_name') |
158 | +from locale import gettext as _ |
159 | |
160 | import logging |
161 | logger = logging.getLogger('python_name') |
162 | |
163 | === modified file 'data/templates/ubuntu-application/project_root/python/Preferencescamel_case_nameDialog.py' |
164 | --- data/templates/ubuntu-application/project_root/python/Preferencescamel_case_nameDialog.py 2011-11-08 02:27:24 +0000 |
165 | +++ data/templates/ubuntu-application/project_root/python/Preferencescamel_case_nameDialog.py 2012-08-17 21:00:25 +0000 |
166 | @@ -11,9 +11,7 @@ |
167 | |
168 | from gi.repository import Gio # pylint: disable=E0611 |
169 | |
170 | -import gettext |
171 | -from gettext import gettext as _ |
172 | -gettext.textdomain('project_name') |
173 | +from locale import gettext as _ |
174 | |
175 | import logging |
176 | logger = logging.getLogger('python_name') |
177 | |
178 | === modified file 'data/templates/ubuntu-application/project_root/python/__init__.py' |
179 | --- data/templates/ubuntu-application/project_root/python/__init__.py 2011-11-07 21:55:54 +0000 |
180 | +++ data/templates/ubuntu-application/project_root/python/__init__.py 2012-08-17 21:00:25 +0000 |
181 | @@ -5,9 +5,7 @@ |
182 | |
183 | import optparse |
184 | |
185 | -import gettext |
186 | -from gettext import gettext as _ |
187 | -gettext.textdomain('project_name') |
188 | +from locale import gettext as _ |
189 | |
190 | from gi.repository import Gtk # pylint: disable=E0611 |
191 | |
192 | |
193 | === modified file 'data/templates/ubuntu-application/project_root/python/camel_case_nameWindow.py' |
194 | --- data/templates/ubuntu-application/project_root/python/camel_case_nameWindow.py 2011-06-08 19:20:41 +0000 |
195 | +++ data/templates/ubuntu-application/project_root/python/camel_case_nameWindow.py 2012-08-17 21:00:25 +0000 |
196 | @@ -3,9 +3,7 @@ |
197 | # This file is in the public domain |
198 | ### END LICENSE |
199 | |
200 | -import gettext |
201 | -from gettext import gettext as _ |
202 | -gettext.textdomain('project_name') |
203 | +from locale import gettext as _ |
204 | |
205 | from gi.repository import Gtk # pylint: disable=E0611 |
206 | import logging |
207 | |
208 | === modified file 'data/templates/ubuntu-application/project_root/python_lib/helpers.py' |
209 | --- data/templates/ubuntu-application/project_root/python_lib/helpers.py 2012-08-17 21:00:25 +0000 |
210 | +++ data/templates/ubuntu-application/project_root/python_lib/helpers.py 2012-08-17 21:00:25 +0000 |
211 | @@ -12,9 +12,7 @@ |
212 | from . python_nameconfig import get_data_file |
213 | from . Builder import Builder |
214 | |
215 | -import gettext |
216 | -from gettext import gettext as _ |
217 | -gettext.textdomain('project_name') |
218 | +from locale import gettext as _ |
219 | |
220 | def get_builder(builder_file_name): |
221 | """Return a fully-instantiated Gtk.Builder instance from specified ui |
222 | |
223 | === modified file 'data/templates/ubuntu-application/project_root/python_lib/python_nameconfig.py' |
224 | --- data/templates/ubuntu-application/project_root/python_lib/python_nameconfig.py 2012-08-17 21:00:25 +0000 |
225 | +++ data/templates/ubuntu-application/project_root/python_lib/python_nameconfig.py 2012-08-17 21:00:25 +0000 |
226 | @@ -19,9 +19,7 @@ |
227 | |
228 | import os |
229 | |
230 | -import gettext |
231 | -from gettext import gettext as _ |
232 | -gettext.textdomain('project_name') |
233 | +from locale import gettext as _ |
234 | |
235 | class project_path_not_found(Exception): |
236 | """Raised when we can't find the project directory.""" |
237 | |
238 | === modified file 'data/templates/ubuntu-application/project_root/setup.py' |
239 | --- data/templates/ubuntu-application/project_root/setup.py 2012-08-17 21:00:25 +0000 |
240 | +++ data/templates/ubuntu-application/project_root/setup.py 2012-08-17 21:00:25 +0000 |
241 | @@ -41,19 +41,49 @@ |
242 | return oldvalues |
243 | |
244 | |
245 | -def update_desktop_file(installdatadir, prefix): |
246 | - |
247 | - filename = os.path.join(installdatadir, 'share', 'applications', |
248 | - 'project_name.desktop') |
249 | +def move_desktop_file(root, target_data, prefix): |
250 | + # The desktop file is rightly installed into install_data. But it should |
251 | + # always really be installed into prefix, because while we can install |
252 | + # normal data files anywhere we want, the desktop file needs to exist in |
253 | + # the main system to be found. Only actually useful for /opt installs. |
254 | + |
255 | + old_desktop_path = os.path.normpath(root + target_data + |
256 | + '/share/applications') |
257 | + old_desktop_file = old_desktop_path + '/project_name.desktop' |
258 | + desktop_path = os.path.normpath(root + prefix + '/share/applications') |
259 | + desktop_file = desktop_path + '/project_name.desktop' |
260 | + |
261 | + if not os.path.exists(old_desktop_file): |
262 | + print ("ERROR: Can't find", old_desktop_file) |
263 | + sys.exit(1) |
264 | + elif target_data != prefix + '/': |
265 | + # This is an /opt install, so rename desktop file to use extras- |
266 | + desktop_file = desktop_path + '/extras-project_name.desktop' |
267 | + try: |
268 | + os.makedirs(desktop_path) |
269 | + os.rename(old_desktop_file, desktop_file) |
270 | + os.rmdir(old_desktop_path) |
271 | + except OSError as e: |
272 | + print ("ERROR: Can't rename", old_desktop_file, ":", e) |
273 | + sys.exit(1) |
274 | + |
275 | + return desktop_file |
276 | + |
277 | +def update_desktop_file(filename, target_pkgdata, target_scripts): |
278 | + |
279 | try: |
280 | fin = file(filename, 'r') |
281 | fout = file(filename + '.new', 'w') |
282 | |
283 | - for line in fin: |
284 | + for line in fin: |
285 | if 'Icon=' in line: |
286 | - line = "Icon=%s\n" % os.path.join(prefix, 'share', |
287 | - 'project_name', 'media', |
288 | - 'project_name.svg') |
289 | + line = "Icon=%s\n" % (target_pkgdata + 'media/project_name.svg') |
290 | + elif 'Exec=' in line: |
291 | + cmd = line.split("=")[1].split(None, 1) |
292 | + line = "Exec=%s" % (target_scripts + 'project_name') |
293 | + if len(cmd) > 1: |
294 | + line += " %s" % cmd[1].strip() # Add script arguments back |
295 | + line += "\n" |
296 | fout.write(line) |
297 | fout.flush() |
298 | fout.close() |
299 | @@ -63,16 +93,30 @@ |
300 | print ("ERROR: Can't find %s" % filename) |
301 | sys.exit(1) |
302 | |
303 | +def compile_schemas(root, target_data): |
304 | + if target_data == '/usr/': |
305 | + return # /usr paths don't need this, they will be handled by dpkg |
306 | + schemadir = os.path.normpath(root + target_data + 'share/glib-2.0/schemas') |
307 | + if (os.path.isdir(schemadir) and |
308 | + os.path.isfile('/usr/bin/glib-compile-schemas')): |
309 | + os.system('/usr/bin/glib-compile-schemas "%s"' % schemadir) |
310 | + |
311 | |
312 | class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto): |
313 | def run(self): |
314 | DistUtilsExtra.auto.install_auto.run(self) |
315 | |
316 | - values = {'__python_name_data_directory__': "'%s'" % (self.prefix + '/share/project_name/'), |
317 | + target_data = '/' + os.path.relpath(self.install_data, self.root) + '/' |
318 | + target_pkgdata = target_data + 'share/project_name/' |
319 | + target_scripts = '/' + os.path.relpath(self.install_scripts, self.root) + '/' |
320 | + |
321 | + values = {'__python_name_data_directory__': "'%s'" % (target_pkgdata), |
322 | '__version__': "'%s'" % self.distribution.get_version()} |
323 | update_config(self.install_lib, values) |
324 | - update_desktop_file(self.install_data, self.prefix) |
325 | |
326 | + desktop_file = move_desktop_file(self.root, target_data, self.prefix) |
327 | + update_desktop_file(desktop_file, target_pkgdata, target_scripts) |
328 | + compile_schemas(self.root, target_data) |
329 | |
330 | |
331 | ################################################################################## |
332 | |
333 | === modified file 'data/templates/ubuntu-application/test/extras.sh' |
334 | --- data/templates/ubuntu-application/test/extras.sh 2012-05-25 17:48:13 +0000 |
335 | +++ data/templates/ubuntu-application/test/extras.sh 2012-08-17 21:00:25 +0000 |
336 | @@ -15,6 +15,8 @@ |
337 | |
338 | quickly license GPL-3 |
339 | |
340 | +sed -i 's/Exec=.*/Exec=test-project arg1 arg2/' test-project.desktop.in |
341 | + |
342 | quickly package --extras | sed 's/^\.\+//' |
343 | # Ubuntu packaging created in debian/ |
344 | # Ubuntu package has been successfully created in ../test-project_0.1_all.deb |
345 | @@ -82,7 +84,7 @@ |
346 | # Name=Test Project |
347 | # Comment=TestProject application |
348 | # Categories=GNOME;Utility; |
349 | -# Exec=/opt/extras.ubuntu.com/test-project/bin/test-project |
350 | +# Exec=/opt/extras.ubuntu.com/test-project/bin/test-project arg1 arg2 |
351 | # Icon=/opt/extras.ubuntu.com/test-project/share/test-project/media/test-project.svg |
352 | # Terminal=false |
353 | # Type=Application |
354 | @@ -91,9 +93,9 @@ |
355 | # __test_project_data_directory__ = '/opt/extras.ubuntu.com/test-project/share/test-project/' |
356 | |
357 | grep -Rh "locale.bindtextdomain" ./opt/extras.ubuntu.com/test-project/bin/test-project |
358 | -# locale.bindtextdomain('test-project', '/opt/extras.ubuntu.com/test-project/share/locale') |
359 | +# locale.bindtextdomain('test-project', '/opt/extras.ubuntu.com/test-project/share/locale') |
360 | |
361 | grep -Rh "^import gettext" ./opt/extras.ubuntu.com/test-project |
362 | |
363 | grep -Rh "XDG_DATA_DIRS" ./opt/extras.ubuntu.com/test-project/bin/test-project |
364 | -# os.putenv("XDG_DATA_DIRS", "%s:%s" % ("/opt/extras.ubuntu.com/test-project/share/", os.getenv("XDG_DATA_DIRS", ""))) |
365 | +# os.putenv("XDG_DATA_DIRS", "%s:%s" % ("/opt/extras.ubuntu.com/test-project/share/", os.getenv("XDG_DATA_DIRS", "/usr/local/share/:/usr/share/"))) |
366 | |
367 | === modified file 'data/templates/ubuntu-application/upgrade.py' |
368 | --- data/templates/ubuntu-application/upgrade.py 2012-08-17 21:00:25 +0000 |
369 | +++ data/templates/ubuntu-application/upgrade.py 2012-08-17 21:00:25 +0000 |
370 | @@ -199,6 +199,16 @@ |
371 | 'quickly upgrade' to get rid of this message.""") |
372 | sys.exit(0) |
373 | |
374 | +if project_version < '12.08.1': |
375 | + sedline = "sed -i '" + \ |
376 | + "s|^import gettext$|import locale|g;" + \ |
377 | + "s|^from gettext import |from locale import |g;" + \ |
378 | + "s|^gettext.textdomain|locale.textdomain|g;" + \ |
379 | + "'" |
380 | + # This find only hits the main module, and that is fine, other files will |
381 | + # be updated by normal overwriting mechanism below. |
382 | + os.system("find %s -name '*.py' -exec %s {} \;" % (python_name, sedline)) |
383 | + |
384 | # Overwrite quickly-owned files as necessary |
385 | if project_version < template_version: |
386 | print _( |
387 | |
388 | === modified file 'data/templates/ubuntu-cli/project_root/python/__init__.py' |
389 | --- data/templates/ubuntu-cli/project_root/python/__init__.py 2011-07-26 07:30:55 +0000 |
390 | +++ data/templates/ubuntu-cli/project_root/python/__init__.py 2012-08-17 21:00:25 +0000 |
391 | @@ -1,9 +1,7 @@ |
392 | import logging |
393 | import optparse |
394 | |
395 | -import gettext |
396 | -from gettext import gettext as _ |
397 | -gettext.textdomain('project_name') |
398 | +from locale import gettext as _ |
399 | |
400 | from python_name import python_nameconfig |
401 | |
402 | |
403 | === modified file 'data/templates/ubuntu-cli/project_root/python/python_nameconfig.py' |
404 | --- data/templates/ubuntu-cli/project_root/python/python_nameconfig.py 2011-03-30 17:57:06 +0000 |
405 | +++ data/templates/ubuntu-cli/project_root/python/python_nameconfig.py 2012-08-17 21:00:25 +0000 |
406 | @@ -22,9 +22,7 @@ |
407 | |
408 | import os |
409 | |
410 | -import gettext |
411 | -from gettext import gettext as _ |
412 | -gettext.textdomain('project_name') |
413 | +from locale import gettext as _ |
414 | |
415 | class project_path_not_found(Exception): |
416 | """Raised when we can't find the project directory.""" |
417 | |
418 | === modified file 'quickly/quicklyconfig.py' |
419 | --- quickly/quicklyconfig.py 2012-08-02 14:29:46 +0000 |
420 | +++ quickly/quicklyconfig.py 2012-08-17 21:00:25 +0000 |
421 | @@ -20,7 +20,7 @@ |
422 | # you're warned :) |
423 | |
424 | # quickly version used for project format compatibility |
425 | -__version__ = '12.08' |
426 | +__version__ = '12.08.1' |
427 | |
428 | # where quickly will head for quickly data (for instance, templates) |
429 | # by default, this is ../data, relative to trunk layout |
430 | |
431 | === modified file 'setup.py' |
432 | --- setup.py 2012-08-02 14:29:46 +0000 |
433 | +++ setup.py 2012-08-17 21:00:25 +0000 |
434 | @@ -18,7 +18,7 @@ |
435 | |
436 | |
437 | # UPDATE VERSION WHEN NEEDED (it updates all versions needed to be updated) |
438 | -VERSION = '12.08' |
439 | +VERSION = '12.08.1' |
440 | |
441 | import glob |
442 | import os |
\o/
The changes are looking good to me (and way better than the packaging insanity).
Some comments:
299 + print ("ERROR: Can't find", filepath)
you missed a %s or at least a space after "find" ;)
370 +print (project_version, template_version)
Is that a leftover?
379 + print("running", "find %s -name '*.py' -exec %s {} \;" % (python_name, sedline))
Hum, same here about print(a, b), this return a tuple, like print("bar", "foo")
('bar', 'foo')
not a friendly one line message, isn't it?
230 -import gettext textdomain( 'project_ name')
231 -from gettext import gettext as _
232 -gettext.
233 +from locale import gettext as _
-> is it better? I have both in OneConf because of some UTF-8 errors and a fallback to the other one. If you have some info on that just for the info, I'll take them gladely :)
Thanks for adding the Exec=foo bar baz test case btw!
Approving (but I would appreciate some answers on my minor quesions before) ;) However, look at the pre-requisite branch which needs a little bit more work IMHO.