Merge lp:~mterry/quickly/arb into lp:quickly

Proposed by Michael Terry
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
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Approve
Review via email: mp+118079@code.launchpad.net

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.

To post a comment you must log in.
lp:~mterry/quickly/arb updated
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

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

\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
231 -from gettext import gettext as _
232 -gettext.textdomain('project_name')
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.

review: Approve
lp:~mterry/quickly/arb updated
693. By Michael Terry

merge latest overwrite branch

694. By Michael Terry

minor cleanup

Revision history for this message
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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'data/templates/ubuntu-application/help/tutorial.xml'
--- data/templates/ubuntu-application/help/tutorial.xml 2012-08-02 14:29:46 +0000
+++ data/templates/ubuntu-application/help/tutorial.xml 2012-08-17 21:00:25 +0000
@@ -3,7 +3,7 @@
3"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [3"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
44
5 <!ENTITY appname "<application>Quickly</application>" >5 <!ENTITY appname "<application>Quickly</application>" >
6 <!ENTITY appversion "12.08" >6 <!ENTITY appversion "12.08.1" >
7] >7] >
88
9<book lang="en" id="index">9<book lang="en" id="index">
1010
=== modified file 'data/templates/ubuntu-application/internal/packaging.py'
--- data/templates/ubuntu-application/internal/packaging.py 2012-07-09 12:16:02 +0000
+++ data/templates/ubuntu-application/internal/packaging.py 2012-08-17 21:00:25 +0000
@@ -159,99 +159,7 @@
159 return(_continue_if_errors(err_output, warn_output, proc.returncode,159 return(_continue_if_errors(err_output, warn_output, proc.returncode,
160 ask_on_warn_or_error))160 ask_on_warn_or_error))
161161
162
163# TODO: Vastly simplify this function. This was implemented post-12.04 to
164# make it easier to get an SRU for these fixes. But the only things here
165# that can't be done in-code (either wrapper code or setup.py) is compiling
166# the schemas and moving the desktop file.
167def update_rules():162def update_rules():
168 project_name = configurationhandler.project_config['project']
169
170 install_rules = """
171override_dh_install:
172 dh_install"""
173
174 opt_root = "/opt/extras.ubuntu.com/" + project_name
175
176 # Move script to bin/ folder.
177 # There are some complications here. As of this writing, current versions
178 # of python-mkdebian do not correctly install our executable script in a
179 # bin/ subdirectory. Instead, they either install it in the opt-project
180 # root or in the opt-project python library folder (depending on whether
181 # the project name is the same as its python name). So if we find that to
182 # be the case, we move the script accordingly.
183 bin_path = "%(opt_root)s/bin/%(project_name)s" % {
184 'opt_root': opt_root, 'project_name': project_name}
185 bad_bin_debpath = "debian/%(project_name)s%(opt_root)s/%(project_name)s" % {
186 'opt_root': opt_root, 'project_name': project_name}
187 python_name = templatetools.python_name(project_name)
188 if project_name == python_name:
189 bad_bin_debpath += "/" + project_name
190 install_rules += """
191 mkdir -p debian/%(project_name)s%(opt_root)s/bin
192 if [ -x %(bad_bin_debpath)s ]; then mv %(bad_bin_debpath)s debian/%(project_name)s%(opt_root)s/bin; fi""" % {
193 'project_name': project_name, 'opt_root': opt_root, 'bad_bin_debpath': bad_bin_debpath}
194
195 # Move desktop file and update it to point to our /opt locations.
196 # The file starts, as expected, under /opt. But the ARB wants and allows
197 # us to install it in /usr, so we do.
198 old_desktop_debdir = "debian/%(project_name)s%(opt_root)s/share/applications" % {
199 'project_name': project_name, 'opt_root': opt_root}
200 new_desktop_debdir = "debian/%(project_name)s/usr/share/applications" % {'project_name': project_name}
201 new_desktop_debpath = new_desktop_debdir + "/extras-" + project_name + ".desktop"
202 install_rules += """
203 if [ -f %(old_desktop_debdir)s/%(project_name)s.desktop ]; then \\
204 mkdir -p %(new_desktop_debdir)s; \\
205 mv %(old_desktop_debdir)s/%(project_name)s.desktop %(new_desktop_debpath)s; \\
206 rmdir --ignore-fail-on-non-empty %(old_desktop_debdir)s; \\
207 sed -i 's|Exec=[^ ]*|Exec=%(bin_path)s|' %(new_desktop_debpath)s; \\
208 sed -i 's|Icon=/usr/|Icon=%(opt_root)s/|' %(new_desktop_debpath)s; \\
209 fi""" % {
210 'bin_path': bin_path, 'old_desktop_debdir': old_desktop_debdir,
211 'new_desktop_debdir': new_desktop_debdir, 'project_name': project_name,
212 'opt_root': opt_root, 'new_desktop_debpath': new_desktop_debpath}
213
214 # Set gettext's bindtextdomain to point to /opt and use the locale
215 # module (gettext's C API) instead of the gettext module (gettext's Python
216 # API), so that translations are loaded from /opt
217 localedir = os.path.join(opt_root, 'share/locale')
218 install_rules += """
219 grep -RlZ 'import gettext' debian/%(project_name)s/* | xargs -0 -r sed -i 's|\(import\) gettext$$|\\1 locale|'
220 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|'
221 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|" """ % {
222 'project_name': project_name, 'localedir': localedir}
223
224 # We install a python_nameconfig.py file that contains a pointer to the
225 # data directory. But that will be determined by setup.py, so it will be
226 # wrong (python-mkdebian's --prefix command only affects where it moves
227 # files during build, but not what it passes to setup.py)
228 config_debpath = "debian/%(project_name)s%(opt_root)s/%(python_name)s*/%(python_name)sconfig.py" % {
229 'project_name': project_name, 'opt_root': opt_root, 'python_name': python_name}
230 install_rules += """
231 sed -i "s|__%(python_name)s_data_directory__ =.*|__%(python_name)s_data_directory__ = '%(opt_root)s/share/%(project_name)s/'|" %(config_debpath)s""" % {
232 'opt_root': opt_root, 'project_name': project_name,
233 'python_name': python_name, 'config_debpath': config_debpath}
234
235 # Adjust XDG_DATA_DIRS so we can find schemas and help files
236 install_rules += """
237 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""" % {
238 'opt_root': opt_root, 'project_name': project_name, 'bin_path': bin_path}
239
240 # Compile the glib schema, since it is in a weird place that normal glib
241 # triggers won't catch during package install.
242 schema_debdir = "debian/%(project_name)s%(opt_root)s/share/glib-2.0/schemas" % {
243 'opt_root': opt_root, 'project_name': project_name}
244 install_rules += """
245 if [ -d %(schema_debdir)s ]; then glib-compile-schemas %(schema_debdir)s; fi""" % {
246 'schema_debdir': schema_debdir}
247
248 # Set rules back to include our changes
249 rules = ''
250 with open('debian/rules', 'r') as f:
251 rules = f.read()
252 rules += install_rules
253 templatetools.set_file_contents('debian/rules', rules)
254
255 # Also update debian/control to add a new Build-Depends needed for163 # Also update debian/control to add a new Build-Depends needed for
256 # glib-compile-schemas164 # glib-compile-schemas
257 templatetools.update_file_content(165 templatetools.update_file_content(
258166
=== modified file 'data/templates/ubuntu-application/project_root/bin/project_name'
--- data/templates/ubuntu-application/project_root/bin/project_name 2012-08-17 21:00:25 +0000
+++ data/templates/ubuntu-application/project_root/bin/project_name 2012-08-17 21:00:25 +0000
@@ -9,9 +9,8 @@
9import sys9import sys
10import os10import os
1111
12import gettext12import locale
13from gettext import gettext as _13locale.textdomain('project_name')
14gettext.textdomain('project_name')
1514
16# Add project root directory (enable symlink and trunk execution)15# Add project root directory (enable symlink and trunk execution)
17PROJECT_ROOT_DIRECTORY = os.path.abspath(16PROJECT_ROOT_DIRECTORY = os.path.abspath(
@@ -19,11 +18,13 @@
1918
20python_path = []19python_path = []
21if os.path.abspath(__file__).startswith('/opt'):20if os.path.abspath(__file__).startswith('/opt'):
21 locale.bindtextdomain('project_name', '/opt/extras.ubuntu.com/project_name/share/locale')
22 syspath = sys.path[:] # copy to avoid infinite loop in pending objects22 syspath = sys.path[:] # copy to avoid infinite loop in pending objects
23 for path in syspath:23 for path in syspath:
24 opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/project_name')24 opt_path = path.replace('/usr', '/opt/extras.ubuntu.com/project_name')
25 python_path.insert(0, opt_path)25 python_path.insert(0, opt_path)
26 sys.path.insert(0, opt_path)26 sys.path.insert(0, opt_path)
27 os.putenv("XDG_DATA_DIRS", "%s:%s" % ("/opt/extras.ubuntu.com/project_name/share/", os.getenv("XDG_DATA_DIRS", "/usr/local/share/:/usr/share/")))
27if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'python_name'))28if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'python_name'))
28 and PROJECT_ROOT_DIRECTORY not in sys.path):29 and PROJECT_ROOT_DIRECTORY not in sys.path):
29 python_path.insert(0, PROJECT_ROOT_DIRECTORY)30 python_path.insert(0, PROJECT_ROOT_DIRECTORY)
3031
=== modified file 'data/templates/ubuntu-application/project_root/python/Aboutcamel_case_nameDialog.py'
--- data/templates/ubuntu-application/project_root/python/Aboutcamel_case_nameDialog.py 2011-04-04 14:28:36 +0000
+++ data/templates/ubuntu-application/project_root/python/Aboutcamel_case_nameDialog.py 2012-08-17 21:00:25 +0000
@@ -3,9 +3,7 @@
3# This file is in the public domain3# This file is in the public domain
4### END LICENSE4### END LICENSE
55
6import gettext6from locale import gettext as _
7from gettext import gettext as _
8gettext.textdomain('project_name')
97
10import logging8import logging
11logger = logging.getLogger('python_name')9logger = logging.getLogger('python_name')
1210
=== modified file 'data/templates/ubuntu-application/project_root/python/Preferencescamel_case_nameDialog.py'
--- data/templates/ubuntu-application/project_root/python/Preferencescamel_case_nameDialog.py 2011-11-08 02:27:24 +0000
+++ data/templates/ubuntu-application/project_root/python/Preferencescamel_case_nameDialog.py 2012-08-17 21:00:25 +0000
@@ -11,9 +11,7 @@
1111
12from gi.repository import Gio # pylint: disable=E061112from gi.repository import Gio # pylint: disable=E0611
1313
14import gettext14from locale import gettext as _
15from gettext import gettext as _
16gettext.textdomain('project_name')
1715
18import logging16import logging
19logger = logging.getLogger('python_name')17logger = logging.getLogger('python_name')
2018
=== modified file 'data/templates/ubuntu-application/project_root/python/__init__.py'
--- data/templates/ubuntu-application/project_root/python/__init__.py 2011-11-07 21:55:54 +0000
+++ data/templates/ubuntu-application/project_root/python/__init__.py 2012-08-17 21:00:25 +0000
@@ -5,9 +5,7 @@
55
6import optparse6import optparse
77
8import gettext8from locale import gettext as _
9from gettext import gettext as _
10gettext.textdomain('project_name')
119
12from gi.repository import Gtk # pylint: disable=E061110from gi.repository import Gtk # pylint: disable=E0611
1311
1412
=== modified file 'data/templates/ubuntu-application/project_root/python/camel_case_nameWindow.py'
--- data/templates/ubuntu-application/project_root/python/camel_case_nameWindow.py 2011-06-08 19:20:41 +0000
+++ data/templates/ubuntu-application/project_root/python/camel_case_nameWindow.py 2012-08-17 21:00:25 +0000
@@ -3,9 +3,7 @@
3# This file is in the public domain3# This file is in the public domain
4### END LICENSE4### END LICENSE
55
6import gettext6from locale import gettext as _
7from gettext import gettext as _
8gettext.textdomain('project_name')
97
10from gi.repository import Gtk # pylint: disable=E06118from gi.repository import Gtk # pylint: disable=E0611
11import logging9import logging
1210
=== modified file 'data/templates/ubuntu-application/project_root/python_lib/helpers.py'
--- data/templates/ubuntu-application/project_root/python_lib/helpers.py 2012-08-17 21:00:25 +0000
+++ data/templates/ubuntu-application/project_root/python_lib/helpers.py 2012-08-17 21:00:25 +0000
@@ -12,9 +12,7 @@
12from . python_nameconfig import get_data_file12from . python_nameconfig import get_data_file
13from . Builder import Builder13from . Builder import Builder
1414
15import gettext15from locale import gettext as _
16from gettext import gettext as _
17gettext.textdomain('project_name')
1816
19def get_builder(builder_file_name):17def get_builder(builder_file_name):
20 """Return a fully-instantiated Gtk.Builder instance from specified ui 18 """Return a fully-instantiated Gtk.Builder instance from specified ui
2119
=== modified file 'data/templates/ubuntu-application/project_root/python_lib/python_nameconfig.py'
--- data/templates/ubuntu-application/project_root/python_lib/python_nameconfig.py 2012-08-17 21:00:25 +0000
+++ data/templates/ubuntu-application/project_root/python_lib/python_nameconfig.py 2012-08-17 21:00:25 +0000
@@ -19,9 +19,7 @@
1919
20import os20import os
2121
22import gettext22from locale import gettext as _
23from gettext import gettext as _
24gettext.textdomain('project_name')
2523
26class project_path_not_found(Exception):24class project_path_not_found(Exception):
27 """Raised when we can't find the project directory."""25 """Raised when we can't find the project directory."""
2826
=== modified file 'data/templates/ubuntu-application/project_root/setup.py'
--- data/templates/ubuntu-application/project_root/setup.py 2012-08-17 21:00:25 +0000
+++ data/templates/ubuntu-application/project_root/setup.py 2012-08-17 21:00:25 +0000
@@ -41,19 +41,49 @@
41 return oldvalues41 return oldvalues
4242
4343
44def update_desktop_file(installdatadir, prefix):44def move_desktop_file(root, target_data, prefix):
4545 # The desktop file is rightly installed into install_data. But it should
46 filename = os.path.join(installdatadir, 'share', 'applications',46 # always really be installed into prefix, because while we can install
47 'project_name.desktop')47 # normal data files anywhere we want, the desktop file needs to exist in
48 # the main system to be found. Only actually useful for /opt installs.
49
50 old_desktop_path = os.path.normpath(root + target_data +
51 '/share/applications')
52 old_desktop_file = old_desktop_path + '/project_name.desktop'
53 desktop_path = os.path.normpath(root + prefix + '/share/applications')
54 desktop_file = desktop_path + '/project_name.desktop'
55
56 if not os.path.exists(old_desktop_file):
57 print ("ERROR: Can't find", old_desktop_file)
58 sys.exit(1)
59 elif target_data != prefix + '/':
60 # This is an /opt install, so rename desktop file to use extras-
61 desktop_file = desktop_path + '/extras-project_name.desktop'
62 try:
63 os.makedirs(desktop_path)
64 os.rename(old_desktop_file, desktop_file)
65 os.rmdir(old_desktop_path)
66 except OSError as e:
67 print ("ERROR: Can't rename", old_desktop_file, ":", e)
68 sys.exit(1)
69
70 return desktop_file
71
72def update_desktop_file(filename, target_pkgdata, target_scripts):
73
48 try:74 try:
49 fin = file(filename, 'r')75 fin = file(filename, 'r')
50 fout = file(filename + '.new', 'w')76 fout = file(filename + '.new', 'w')
5177
52 for line in fin: 78 for line in fin:
53 if 'Icon=' in line:79 if 'Icon=' in line:
54 line = "Icon=%s\n" % os.path.join(prefix, 'share',80 line = "Icon=%s\n" % (target_pkgdata + 'media/project_name.svg')
55 'project_name', 'media',81 elif 'Exec=' in line:
56 'project_name.svg')82 cmd = line.split("=")[1].split(None, 1)
83 line = "Exec=%s" % (target_scripts + 'project_name')
84 if len(cmd) > 1:
85 line += " %s" % cmd[1].strip() # Add script arguments back
86 line += "\n"
57 fout.write(line)87 fout.write(line)
58 fout.flush()88 fout.flush()
59 fout.close()89 fout.close()
@@ -63,16 +93,30 @@
63 print ("ERROR: Can't find %s" % filename)93 print ("ERROR: Can't find %s" % filename)
64 sys.exit(1)94 sys.exit(1)
6595
96def compile_schemas(root, target_data):
97 if target_data == '/usr/':
98 return # /usr paths don't need this, they will be handled by dpkg
99 schemadir = os.path.normpath(root + target_data + 'share/glib-2.0/schemas')
100 if (os.path.isdir(schemadir) and
101 os.path.isfile('/usr/bin/glib-compile-schemas')):
102 os.system('/usr/bin/glib-compile-schemas "%s"' % schemadir)
103
66104
67class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):105class InstallAndUpdateDataDirectory(DistUtilsExtra.auto.install_auto):
68 def run(self):106 def run(self):
69 DistUtilsExtra.auto.install_auto.run(self)107 DistUtilsExtra.auto.install_auto.run(self)
70108
71 values = {'__python_name_data_directory__': "'%s'" % (self.prefix + '/share/project_name/'),109 target_data = '/' + os.path.relpath(self.install_data, self.root) + '/'
110 target_pkgdata = target_data + 'share/project_name/'
111 target_scripts = '/' + os.path.relpath(self.install_scripts, self.root) + '/'
112
113 values = {'__python_name_data_directory__': "'%s'" % (target_pkgdata),
72 '__version__': "'%s'" % self.distribution.get_version()}114 '__version__': "'%s'" % self.distribution.get_version()}
73 update_config(self.install_lib, values)115 update_config(self.install_lib, values)
74 update_desktop_file(self.install_data, self.prefix)
75116
117 desktop_file = move_desktop_file(self.root, target_data, self.prefix)
118 update_desktop_file(desktop_file, target_pkgdata, target_scripts)
119 compile_schemas(self.root, target_data)
76120
77 121
78##################################################################################122##################################################################################
79123
=== modified file 'data/templates/ubuntu-application/test/extras.sh'
--- data/templates/ubuntu-application/test/extras.sh 2012-05-25 17:48:13 +0000
+++ data/templates/ubuntu-application/test/extras.sh 2012-08-17 21:00:25 +0000
@@ -15,6 +15,8 @@
1515
16quickly license GPL-316quickly license GPL-3
1717
18sed -i 's/Exec=.*/Exec=test-project arg1 arg2/' test-project.desktop.in
19
18quickly package --extras | sed 's/^\.\+//'20quickly package --extras | sed 's/^\.\+//'
19# Ubuntu packaging created in debian/21# Ubuntu packaging created in debian/
20# Ubuntu package has been successfully created in ../test-project_0.1_all.deb22# Ubuntu package has been successfully created in ../test-project_0.1_all.deb
@@ -82,7 +84,7 @@
82# Name=Test Project84# Name=Test Project
83# Comment=TestProject application85# Comment=TestProject application
84# Categories=GNOME;Utility;86# Categories=GNOME;Utility;
85# Exec=/opt/extras.ubuntu.com/test-project/bin/test-project87# Exec=/opt/extras.ubuntu.com/test-project/bin/test-project arg1 arg2
86# Icon=/opt/extras.ubuntu.com/test-project/share/test-project/media/test-project.svg88# Icon=/opt/extras.ubuntu.com/test-project/share/test-project/media/test-project.svg
87# Terminal=false89# Terminal=false
88# Type=Application90# Type=Application
@@ -91,9 +93,9 @@
91# __test_project_data_directory__ = '/opt/extras.ubuntu.com/test-project/share/test-project/'93# __test_project_data_directory__ = '/opt/extras.ubuntu.com/test-project/share/test-project/'
9294
93grep -Rh "locale.bindtextdomain" ./opt/extras.ubuntu.com/test-project/bin/test-project95grep -Rh "locale.bindtextdomain" ./opt/extras.ubuntu.com/test-project/bin/test-project
94# locale.bindtextdomain('test-project', '/opt/extras.ubuntu.com/test-project/share/locale')96# locale.bindtextdomain('test-project', '/opt/extras.ubuntu.com/test-project/share/locale')
9597
96grep -Rh "^import gettext" ./opt/extras.ubuntu.com/test-project98grep -Rh "^import gettext" ./opt/extras.ubuntu.com/test-project
9799
98grep -Rh "XDG_DATA_DIRS" ./opt/extras.ubuntu.com/test-project/bin/test-project100grep -Rh "XDG_DATA_DIRS" ./opt/extras.ubuntu.com/test-project/bin/test-project
99# os.putenv("XDG_DATA_DIRS", "%s:%s" % ("/opt/extras.ubuntu.com/test-project/share/", os.getenv("XDG_DATA_DIRS", "")))101# os.putenv("XDG_DATA_DIRS", "%s:%s" % ("/opt/extras.ubuntu.com/test-project/share/", os.getenv("XDG_DATA_DIRS", "/usr/local/share/:/usr/share/")))
100102
=== modified file 'data/templates/ubuntu-application/upgrade.py'
--- data/templates/ubuntu-application/upgrade.py 2012-08-17 21:00:25 +0000
+++ data/templates/ubuntu-application/upgrade.py 2012-08-17 21:00:25 +0000
@@ -199,6 +199,16 @@
199'quickly upgrade' to get rid of this message.""")199'quickly upgrade' to get rid of this message.""")
200 sys.exit(0)200 sys.exit(0)
201201
202if project_version < '12.08.1':
203 sedline = "sed -i '" + \
204 "s|^import gettext$|import locale|g;" + \
205 "s|^from gettext import |from locale import |g;" + \
206 "s|^gettext.textdomain|locale.textdomain|g;" + \
207 "'"
208 # This find only hits the main module, and that is fine, other files will
209 # be updated by normal overwriting mechanism below.
210 os.system("find %s -name '*.py' -exec %s {} \;" % (python_name, sedline))
211
202# Overwrite quickly-owned files as necessary212# Overwrite quickly-owned files as necessary
203if project_version < template_version:213if project_version < template_version:
204 print _(214 print _(
205215
=== modified file 'data/templates/ubuntu-cli/project_root/python/__init__.py'
--- data/templates/ubuntu-cli/project_root/python/__init__.py 2011-07-26 07:30:55 +0000
+++ data/templates/ubuntu-cli/project_root/python/__init__.py 2012-08-17 21:00:25 +0000
@@ -1,9 +1,7 @@
1import logging1import logging
2import optparse2import optparse
33
4import gettext4from locale import gettext as _
5from gettext import gettext as _
6gettext.textdomain('project_name')
75
8from python_name import python_nameconfig6from python_name import python_nameconfig
97
108
=== modified file 'data/templates/ubuntu-cli/project_root/python/python_nameconfig.py'
--- data/templates/ubuntu-cli/project_root/python/python_nameconfig.py 2011-03-30 17:57:06 +0000
+++ data/templates/ubuntu-cli/project_root/python/python_nameconfig.py 2012-08-17 21:00:25 +0000
@@ -22,9 +22,7 @@
2222
23import os23import os
2424
25import gettext25from locale import gettext as _
26from gettext import gettext as _
27gettext.textdomain('project_name')
2826
29class project_path_not_found(Exception):27class project_path_not_found(Exception):
30 """Raised when we can't find the project directory."""28 """Raised when we can't find the project directory."""
3129
=== modified file 'quickly/quicklyconfig.py'
--- quickly/quicklyconfig.py 2012-08-02 14:29:46 +0000
+++ quickly/quicklyconfig.py 2012-08-17 21:00:25 +0000
@@ -20,7 +20,7 @@
20# you're warned :)20# you're warned :)
2121
22# quickly version used for project format compatibility22# quickly version used for project format compatibility
23__version__ = '12.08'23__version__ = '12.08.1'
2424
25# where quickly will head for quickly data (for instance, templates)25# where quickly will head for quickly data (for instance, templates)
26# by default, this is ../data, relative to trunk layout26# by default, this is ../data, relative to trunk layout
2727
=== modified file 'setup.py'
--- setup.py 2012-08-02 14:29:46 +0000
+++ setup.py 2012-08-17 21:00:25 +0000
@@ -18,7 +18,7 @@
1818
1919
20# UPDATE VERSION WHEN NEEDED (it updates all versions needed to be updated)20# UPDATE VERSION WHEN NEEDED (it updates all versions needed to be updated)
21VERSION = '12.08'21VERSION = '12.08.1'
2222
23import glob23import glob
24import os24import os

Subscribers

People subscribed via source and target branches