Merge lp:~mvo/ubuntu-release-upgrader/use-str.format into lp:ubuntu-release-upgrader
- use-str.format
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Michael Vogt |
Proposed branch: | lp:~mvo/ubuntu-release-upgrader/use-str.format |
Merge into: | lp:ubuntu-release-upgrader |
Diff against target: |
888 lines (+175/-142) 14 files modified
DistUpgrade/DistUpgradeAptCdrom.py (+1/-1) DistUpgrade/DistUpgradeCache.py (+10/-10) DistUpgrade/DistUpgradeController.py (+39/-38) DistUpgrade/DistUpgradeFetcherCore.py (+5/-5) DistUpgrade/DistUpgradeFetcherKDE.py (+4/-3) DistUpgrade/DistUpgradeGettext.py (+7/-2) DistUpgrade/DistUpgradeView.py (+27/-24) DistUpgrade/DistUpgradeViewGtk3.py (+25/-21) DistUpgrade/DistUpgradeViewKDE.py (+23/-15) DistUpgrade/DistUpgradeViewText.py (+10/-5) DistUpgrade/GtkProgress.py (+8/-8) check-new-release-gtk (+8/-7) do-partial-upgrade (+3/-3) pre-build.sh (+5/-0) |
To merge this branch: | bzr merge lp:~mvo/ubuntu-release-upgrader/use-str.format |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Core Development Team | Pending | ||
Review via email: mp+217004@code.launchpad.net |
Commit message
Description of the change
Use str.format() with gettext (eventually everywhere) to avoid crashes if e.g. incorrect translations are specified. The worst case with str.format() is that the information is not displayed correctly, but it won't crash like e.g. LP: #1311396
Michael Terry (mterry) wrote : | # |
Michael Vogt (mvo) wrote : | # |
Hi Michael, thanks for your comment. Indeed, I should have been more clear.
The issue that is fixed is:
$ python -c 'print("foo" % "bar")'
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: not all arguments converted during string formatting
$ python -c 'print(
foo
But yes, if a translation has a incorrect number of {} it will still crash, so maybe its not worth
doing all the work and instead use the "Foo %(bar)s" % { "bar": "some-str" } approach where its
also ok to leave out a argument. I.e.
$ python -c 'print("foo" % {"bar": "bar"})'
foo
Barry Warsaw (barry) wrote : | # |
It might be a lot of work to port, but I will suggest using my flufl.i18n package, which has a lot of nice convenience APIs and safeguards for doing i18n interpolation.
http://
And of course, it's packaged up :).
Barry Warsaw (barry) wrote : | # |
Also note that with modern Pythons
'{0}'.format('foo')
is equivalent to
'{}'.format('foo')
Unmerged revisions
- 2779. By Michael Vogt
-
replace all %s style format with str.format() in gettext to be more robust against crashes from incorrectly formated translations
- 2778. By Michael Vogt
-
use str.format() for all ngettext() to avoid crashes on incorrect number of parameters (LP: #1311396
Preview Diff
1 | === modified file 'DistUpgrade/DistUpgradeAptCdrom.py' | |||
2 | --- DistUpgrade/DistUpgradeAptCdrom.py 2012-06-12 13:52:04 +0000 | |||
3 | +++ DistUpgrade/DistUpgradeAptCdrom.py 2014-04-24 08:46:39 +0000 | |||
4 | @@ -295,7 +295,7 @@ | |||
5 | 295 | _("There was a error adding the CD, the " | 295 | _("There was a error adding the CD, the " |
6 | 296 | "upgrade will abort. Please report this as " | 296 | "upgrade will abort. Please report this as " |
7 | 297 | "a bug if this is a valid Ubuntu CD.\n\n" | 297 | "a bug if this is a valid Ubuntu CD.\n\n" |
9 | 298 | "The error message was:\n'%s'") % e) | 298 | "The error message was:\n'{0}'").format(e)) |
10 | 299 | return False | 299 | return False |
11 | 300 | logging.debug("AptCdrom.add() returned: %s" % res) | 300 | logging.debug("AptCdrom.add() returned: %s" % res) |
12 | 301 | return res | 301 | return res |
13 | 302 | 302 | ||
14 | === modified file 'DistUpgrade/DistUpgradeCache.py' | |||
15 | --- DistUpgrade/DistUpgradeCache.py 2014-04-15 08:57:53 +0000 | |||
16 | +++ DistUpgrade/DistUpgradeCache.py 2014-04-24 08:46:39 +0000 | |||
17 | @@ -152,17 +152,17 @@ | |||
18 | 152 | header = ngettext("Remove package in bad state", | 152 | header = ngettext("Remove package in bad state", |
19 | 153 | "Remove packages in bad state", | 153 | "Remove packages in bad state", |
20 | 154 | len(reqreinst)) | 154 | len(reqreinst)) |
22 | 155 | summary = ngettext("The package '%s' is in an inconsistent " | 155 | summary = ngettext("The package '{0}' is in an inconsistent " |
23 | 156 | "state and needs to be reinstalled, but " | 156 | "state and needs to be reinstalled, but " |
24 | 157 | "no archive can be found for it. " | 157 | "no archive can be found for it. " |
25 | 158 | "Do you want to remove this package " | 158 | "Do you want to remove this package " |
26 | 159 | "now to continue?", | 159 | "now to continue?", |
28 | 160 | "The packages '%s' are in an inconsistent " | 160 | "The packages '{0}' are in an inconsistent " |
29 | 161 | "state and need to be reinstalled, but " | 161 | "state and need to be reinstalled, but " |
30 | 162 | "no archives can be found for them. Do you " | 162 | "no archives can be found for them. Do you " |
31 | 163 | "want to remove these packages now to " | 163 | "want to remove these packages now to " |
32 | 164 | "continue?", | 164 | "continue?", |
34 | 165 | len(reqreinst)) % ", ".join(reqreinst) | 165 | len(reqreinst)).format(", ".join(reqreinst)) |
35 | 166 | if view.askYesNoQuestion(header, summary): | 166 | if view.askYesNoQuestion(header, summary): |
36 | 167 | self.release_lock() | 167 | self.release_lock() |
37 | 168 | cmd = ["/usr/bin/dpkg", "--remove", "--force-remove-reinstreq"] + list(reqreinst) | 168 | cmd = ["/usr/bin/dpkg", "--remove", "--force-remove-reinstreq"] + list(reqreinst) |
38 | @@ -727,13 +727,13 @@ | |||
39 | 727 | for pkg in self.get_changes(): | 727 | for pkg in self.get_changes(): |
40 | 728 | if pkg.marked_delete and self._inRemovalBlacklist(pkg.name): | 728 | if pkg.marked_delete and self._inRemovalBlacklist(pkg.name): |
41 | 729 | logging.debug("The package '%s' is marked for removal but it's in the removal blacklist", pkg.name) | 729 | logging.debug("The package '%s' is marked for removal but it's in the removal blacklist", pkg.name) |
43 | 730 | raise SystemError(_("The package '%s' is marked for removal but it is in the removal blacklist.") % pkg.name) | 730 | raise SystemError(_("The package '{0}' is marked for removal but it is in the removal blacklist.").format(pkg.name)) |
44 | 731 | if pkg.marked_delete and ( | 731 | if pkg.marked_delete and ( |
45 | 732 | pkg._pkg.essential == True and | 732 | pkg._pkg.essential == True and |
46 | 733 | pkg.installed.architecture == main_arch and | 733 | pkg.installed.architecture == main_arch and |
47 | 734 | not pkg.name in removeEssentialOk): | 734 | not pkg.name in removeEssentialOk): |
48 | 735 | logging.debug("The package '%s' is marked for removal but it's an ESSENTIAL package", pkg.name) | 735 | logging.debug("The package '%s' is marked for removal but it's an ESSENTIAL package", pkg.name) |
50 | 736 | raise SystemError(_("The essential package '%s' is marked for removal.") % pkg.name) | 736 | raise SystemError(_("The essential package '{0}' is marked for removal.").format(pkg.name)) |
51 | 737 | # check bad-versions blacklist | 737 | # check bad-versions blacklist |
52 | 738 | badVersions = self.config.getlist("Distro", "BadVersions") | 738 | badVersions = self.config.getlist("Distro", "BadVersions") |
53 | 739 | for bv in badVersions: | 739 | for bv in badVersions: |
54 | @@ -742,7 +742,7 @@ | |||
55 | 742 | self[pkgname].candidate.version == ver and | 742 | self[pkgname].candidate.version == ver and |
56 | 743 | (self[pkgname].marked_install or | 743 | (self[pkgname].marked_install or |
57 | 744 | self[pkgname].marked_upgrade)): | 744 | self[pkgname].marked_upgrade)): |
59 | 745 | raise SystemError(_("Trying to install blacklisted version '%s'") % bv) | 745 | raise SystemError(_("Trying to install blacklisted version '{0}'").format(bv)) |
60 | 746 | return True | 746 | return True |
61 | 747 | 747 | ||
62 | 748 | def _lookupPkgRecord(self, pkg): | 748 | def _lookupPkgRecord(self, pkg): |
63 | @@ -861,7 +861,7 @@ | |||
64 | 861 | except (SystemError, KeyError) as e: | 861 | except (SystemError, KeyError) as e: |
65 | 862 | logging.error("failed to mark '%s' for install (%s)" % | 862 | logging.error("failed to mark '%s' for install (%s)" % |
66 | 863 | (key, e)) | 863 | (key, e)) |
68 | 864 | view.error(_("Can't install '%s'") % key, | 864 | view.error(_("Can't install '{0}'").format(key), |
69 | 865 | _("It was impossible to install a " | 865 | _("It was impossible to install a " |
70 | 866 | "required package. Please report " | 866 | "required package. Please report " |
71 | 867 | "this as a bug using " | 867 | "this as a bug using " |
72 | @@ -875,13 +875,13 @@ | |||
73 | 875 | meta_pkgs = ', '.join(metapkgs[0:-1]) | 875 | meta_pkgs = ', '.join(metapkgs[0:-1]) |
74 | 876 | view.error(_("Can't guess meta-package"), | 876 | view.error(_("Can't guess meta-package"), |
75 | 877 | _("Your system does not contain a " | 877 | _("Your system does not contain a " |
77 | 878 | "%s or %s package and it was not " | 878 | "{0} or {1} package and it was not " |
78 | 879 | "possible to detect which version of " | 879 | "possible to detect which version of " |
79 | 880 | "Ubuntu you are running.\n " | 880 | "Ubuntu you are running.\n " |
80 | 881 | "Please install one of the packages " | 881 | "Please install one of the packages " |
81 | 882 | "above first using synaptic or " | 882 | "above first using synaptic or " |
84 | 883 | "apt-get before proceeding.") % | 883 | "apt-get before proceeding.").format( |
85 | 884 | (meta_pkgs, metapkgs[-1])) | 884 | meta_pkgs, metapkgs[-1])) |
86 | 885 | return False | 885 | return False |
87 | 886 | return True | 886 | return True |
88 | 887 | 887 | ||
89 | 888 | 888 | ||
90 | === modified file 'DistUpgrade/DistUpgradeController.py' | |||
91 | --- DistUpgrade/DistUpgradeController.py 2014-04-11 22:30:39 +0000 | |||
92 | +++ DistUpgrade/DistUpgradeController.py 2014-04-24 08:46:39 +0000 | |||
93 | @@ -307,8 +307,8 @@ | |||
94 | 307 | "over ssh currently because in case of failure " | 307 | "over ssh currently because in case of failure " |
95 | 308 | "it is harder to recover.\n\n" | 308 | "it is harder to recover.\n\n" |
96 | 309 | "If you continue, an additional ssh daemon will be " | 309 | "If you continue, an additional ssh daemon will be " |
99 | 310 | "started at port '%s'.\n" | 310 | "started at port '{0}'.\n" |
100 | 311 | "Do you want to continue?") % port) | 311 | "Do you want to continue?").format(port)) |
101 | 312 | # abort | 312 | # abort |
102 | 313 | if res == False: | 313 | if res == False: |
103 | 314 | sys.exit(1) | 314 | sys.exit(1) |
104 | @@ -318,10 +318,10 @@ | |||
105 | 318 | if res == 0: | 318 | if res == 0: |
106 | 319 | summary = _("Starting additional sshd") | 319 | summary = _("Starting additional sshd") |
107 | 320 | descr = _("To make recovery in case of failure easier, an " | 320 | descr = _("To make recovery in case of failure easier, an " |
109 | 321 | "additional sshd will be started on port '%s'. " | 321 | "additional sshd will be started on port '{0}'. " |
110 | 322 | "If anything goes wrong with the running ssh " | 322 | "If anything goes wrong with the running ssh " |
111 | 323 | "you can still connect to the additional one.\n" | 323 | "you can still connect to the additional one.\n" |
113 | 324 | ) % port | 324 | ).format(port) |
114 | 325 | if iptables_active(): | 325 | if iptables_active(): |
115 | 326 | cmd = "iptables -I INPUT -p tcp --dport %s -j ACCEPT" % port | 326 | cmd = "iptables -I INPUT -p tcp --dport %s -j ACCEPT" % port |
116 | 327 | descr += _( | 327 | descr += _( |
117 | @@ -398,8 +398,9 @@ | |||
118 | 398 | if not (release == self.fromDist or release == self.toDist): | 398 | if not (release == self.fromDist or release == self.toDist): |
119 | 399 | logging.error("Bad upgrade: '%s' != '%s' " % (release, self.fromDist)) | 399 | logging.error("Bad upgrade: '%s' != '%s' " % (release, self.fromDist)) |
120 | 400 | self._view.error(_("Can not upgrade"), | 400 | self._view.error(_("Can not upgrade"), |
123 | 401 | _("An upgrade from '%s' to '%s' is not " | 401 | _("An upgrade from '{0}' to '{1}' is not " |
124 | 402 | "supported with this tool." % (release, self.toDist))) | 402 | "supported with this tool.").format( |
125 | 403 | release, self.toDist)) | ||
126 | 403 | sys.exit(1) | 404 | sys.exit(1) |
127 | 404 | 405 | ||
128 | 405 | # setup aufs | 406 | # setup aufs |
129 | @@ -417,11 +418,11 @@ | |||
130 | 417 | self._view.information(_("Sandbox mode"), | 418 | self._view.information(_("Sandbox mode"), |
131 | 418 | _("This upgrade is running in sandbox " | 419 | _("This upgrade is running in sandbox " |
132 | 419 | "(test) mode. All changes are written " | 420 | "(test) mode. All changes are written " |
134 | 420 | "to '%s' and will be lost on the next " | 421 | "to '{0}' and will be lost on the next " |
135 | 421 | "reboot.\n\n" | 422 | "reboot.\n\n" |
136 | 422 | "*No* changes written to a system directory " | 423 | "*No* changes written to a system directory " |
137 | 423 | "from now until the next reboot are " | 424 | "from now until the next reboot are " |
139 | 424 | "permanent.") % aufs_rw_dir) | 425 | "permanent.").format(aufs_rw_dir)) |
140 | 425 | 426 | ||
141 | 426 | # setup backports (if we have them) | 427 | # setup backports (if we have them) |
142 | 427 | if self.options and self.options.havePrerequists: | 428 | if self.options and self.options.havePrerequists: |
143 | @@ -482,12 +483,12 @@ | |||
144 | 482 | if os.path.exists(systemdir) and not os.access(systemdir, os.W_OK): | 483 | if os.path.exists(systemdir) and not os.access(systemdir, os.W_OK): |
145 | 483 | logging.error("%s not writable" % systemdir) | 484 | logging.error("%s not writable" % systemdir) |
146 | 484 | self._view.error( | 485 | self._view.error( |
148 | 485 | _("Can not write to '%s'") % systemdir, | 486 | _("Can not write to '{0}'").format(systemdir), |
149 | 486 | _("Its not possible to write to the system directory " | 487 | _("Its not possible to write to the system directory " |
151 | 487 | "'%s' on your system. The upgrade can not " | 488 | "'{0}' on your system. The upgrade can not " |
152 | 488 | "continue.\n" | 489 | "continue.\n" |
153 | 489 | "Please make sure that the system directory is " | 490 | "Please make sure that the system directory is " |
155 | 490 | "writable.") % systemdir) | 491 | "writable.").format(systemdir)) |
156 | 491 | self.abort() | 492 | self.abort() |
157 | 492 | 493 | ||
158 | 493 | 494 | ||
159 | @@ -640,7 +641,7 @@ | |||
160 | 640 | "%s-proposed" % self.fromDist in entry.dist): | 641 | "%s-proposed" % self.fromDist in entry.dist): |
161 | 641 | logging.debug("upgrade to development release, disabling proposed") | 642 | logging.debug("upgrade to development release, disabling proposed") |
162 | 642 | entry.dist = "%s-proposed" % self.toDist | 643 | entry.dist = "%s-proposed" % self.toDist |
164 | 643 | entry.comment += _("Not for humans during development stage of release %s") % self.toDist | 644 | entry.comment += _("Not for humans during development stage of release {0}").format(self.toDist) |
165 | 644 | entry.disabled = True | 645 | entry.disabled = True |
166 | 645 | continue | 646 | continue |
167 | 646 | 647 | ||
168 | @@ -726,7 +727,7 @@ | |||
169 | 726 | # disable anything that is not from a official mirror or a whitelisted third party | 727 | # disable anything that is not from a official mirror or a whitelisted third party |
170 | 727 | if entry.dist == self.fromDist: | 728 | if entry.dist == self.fromDist: |
171 | 728 | entry.dist = self.toDist | 729 | entry.dist = self.toDist |
173 | 729 | disable_comment = " " + _("disabled on upgrade to %s") % self.toDist | 730 | disable_comment = " " + _("disabled on upgrade to {0}").format(self.toDist) |
174 | 730 | if isinstance(entry.comment, bytes): | 731 | if isinstance(entry.comment, bytes): |
175 | 731 | entry.comment += disable_comment.encode('UTF-8') | 732 | entry.comment += disable_comment.encode('UTF-8') |
176 | 732 | else: | 733 | else: |
177 | @@ -770,10 +771,10 @@ | |||
178 | 770 | "out of date.\n\n" | 771 | "out of date.\n\n" |
179 | 771 | "Do you want to rewrite your " | 772 | "Do you want to rewrite your " |
180 | 772 | "'sources.list' file anyway? If you choose " | 773 | "'sources.list' file anyway? If you choose " |
182 | 773 | "'Yes' here it will update all '%s' to '%s' " | 774 | "'Yes' here it will update all '{0}' to '{1}' " |
183 | 774 | "entries.\n" | 775 | "entries.\n" |
184 | 775 | "If you select 'No' the upgrade will cancel." | 776 | "If you select 'No' the upgrade will cancel." |
186 | 776 | ) % (self.fromDist, self.toDist)) | 777 | ).format(self.fromDist, self.toDist)) |
187 | 777 | if res: | 778 | if res: |
188 | 778 | # re-init the sources and try again | 779 | # re-init the sources and try again |
189 | 779 | self.sources = SourcesList(matcherPath=".") | 780 | self.sources = SourcesList(matcherPath=".") |
190 | @@ -784,10 +785,10 @@ | |||
191 | 784 | #hm, still nothing useful ... | 785 | #hm, still nothing useful ... |
192 | 785 | prim = _("Generate default sources?") | 786 | prim = _("Generate default sources?") |
193 | 786 | secon = _("After scanning your 'sources.list' no " | 787 | secon = _("After scanning your 'sources.list' no " |
196 | 787 | "valid entry for '%s' was found.\n\n" | 788 | "valid entry for '{0}' was found.\n\n" |
197 | 788 | "Should default entries for '%s' be " | 789 | "Should default entries for '{1}' be " |
198 | 789 | "added? If you select 'No', the upgrade " | 790 | "added? If you select 'No', the upgrade " |
200 | 790 | "will cancel.") % (self.fromDist, self.toDist) | 791 | "will cancel.").format(self.fromDist, self.toDist) |
201 | 791 | if not self._view.askYesNoQuestion(prim, secon): | 792 | if not self._view.askYesNoQuestion(prim, secon): |
202 | 792 | self.abort() | 793 | self.abort() |
203 | 793 | 794 | ||
204 | @@ -880,17 +881,17 @@ | |||
205 | 880 | header = ngettext("Package in inconsistent state", | 881 | header = ngettext("Package in inconsistent state", |
206 | 881 | "Packages in inconsistent state", | 882 | "Packages in inconsistent state", |
207 | 882 | len(reqreinst)) | 883 | len(reqreinst)) |
209 | 883 | summary = ngettext("The package '%s' is in an inconsistent " | 884 | summary = ngettext("The package '{0}' is in an inconsistent " |
210 | 884 | "state and needs to be reinstalled, but " | 885 | "state and needs to be reinstalled, but " |
211 | 885 | "no archive can be found for it. " | 886 | "no archive can be found for it. " |
212 | 886 | "Please reinstall the package manually " | 887 | "Please reinstall the package manually " |
213 | 887 | "or remove it from the system.", | 888 | "or remove it from the system.", |
215 | 888 | "The packages '%s' are in an inconsistent " | 889 | "The packages '{0}' are in an inconsistent " |
216 | 889 | "state and need to be reinstalled, but " | 890 | "state and need to be reinstalled, but " |
217 | 890 | "no archive can be found for them. " | 891 | "no archive can be found for them. " |
218 | 891 | "Please reinstall the packages manually " | 892 | "Please reinstall the packages manually " |
219 | 892 | "or remove them from the system.", | 893 | "or remove them from the system.", |
221 | 893 | len(reqreinst)) % ", ".join(reqreinst) | 894 | len(reqreinst)).format(", ".join(reqreinst)) |
222 | 894 | self._view.error(header, summary) | 895 | self._view.error(header, summary) |
223 | 895 | return False | 896 | return False |
224 | 896 | # FIXME: check out what packages are downloadable etc to | 897 | # FIXME: check out what packages are downloadable etc to |
225 | @@ -899,8 +900,8 @@ | |||
226 | 899 | self.foreign_pkgs = self.cache._getForeignPkgs(self.origin, self.fromDist, self.toDist) | 900 | self.foreign_pkgs = self.cache._getForeignPkgs(self.origin, self.fromDist, self.toDist) |
227 | 900 | if self.serverMode: | 901 | if self.serverMode: |
228 | 901 | self.tasks = self.cache.installedTasks | 902 | self.tasks = self.cache.installedTasks |
231 | 902 | logging.debug("Foreign: %s" % " ".join(self.foreign_pkgs)) | 903 | logging.debug("Foreign: {0}".format(" ".join(self.foreign_pkgs))) |
232 | 903 | logging.debug("Obsolete: %s" % " ".join(self.obsolete_pkgs)) | 904 | logging.debug("Obsolete: {0}".format(" ".join(self.obsolete_pkgs))) |
233 | 904 | return True | 905 | return True |
234 | 905 | 906 | ||
235 | 906 | def doUpdate(self, showErrors=True, forceRetries=None): | 907 | def doUpdate(self, showErrors=True, forceRetries=None): |
236 | @@ -940,9 +941,10 @@ | |||
237 | 940 | " this checks if we have enough free space on /var and /usr" | 941 | " this checks if we have enough free space on /var and /usr" |
238 | 941 | err_sum = _("Not enough free disk space") | 942 | err_sum = _("Not enough free disk space") |
239 | 942 | err_long= _("The upgrade has aborted. " | 943 | err_long= _("The upgrade has aborted. " |
243 | 943 | "The upgrade needs a total of %s free space on disk '%s'. " | 944 | "The upgrade needs a total of {0} free space on disk " |
244 | 944 | "Please free at least an additional %s of disk " | 945 | "'{1}'. " |
245 | 945 | "space on '%s'. " | 946 | "Please free at least an additional {2} of disk " |
246 | 947 | "space on '{3}'. " | ||
247 | 946 | "Empty your trash and remove temporary " | 948 | "Empty your trash and remove temporary " |
248 | 947 | "packages of former installations using " | 949 | "packages of former installations using " |
249 | 948 | "'sudo apt-get clean'.") | 950 | "'sudo apt-get clean'.") |
250 | @@ -959,10 +961,10 @@ | |||
251 | 959 | # perspective, but it means we do not need to break the | 961 | # perspective, but it means we do not need to break the |
252 | 960 | # string freeze | 962 | # string freeze |
253 | 961 | for required in e.free_space_required_list: | 963 | for required in e.free_space_required_list: |
258 | 962 | self._view.error(err_sum, err_long % (required.size_total, | 964 | self._view.error(err_sum, err_long.format(required.size_total, |
259 | 963 | required.dir, | 965 | required.dir, |
260 | 964 | required.size_needed, | 966 | required.size_needed, |
261 | 965 | required.dir)) | 967 | required.dir)) |
262 | 966 | return False | 968 | return False |
263 | 967 | return True | 969 | return True |
264 | 968 | 970 | ||
265 | @@ -1172,7 +1174,7 @@ | |||
266 | 1172 | "http://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebug " | 1174 | "http://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebug " |
267 | 1173 | "and attach the files in /var/log/dist-upgrade/ " | 1175 | "and attach the files in /var/log/dist-upgrade/ " |
268 | 1174 | "to the bug report.\n" | 1176 | "to the bug report.\n" |
270 | 1175 | "%s" % e) | 1177 | "{0}".format(e)) |
271 | 1176 | self._view.error(_("Could not install the upgrades"), msg) | 1178 | self._view.error(_("Could not install the upgrades"), msg) |
272 | 1177 | # installing the packages failed, can't be retried | 1179 | # installing the packages failed, can't be retried |
273 | 1178 | cmd = ["/usr/bin/dpkg","--configure","-a"] | 1180 | cmd = ["/usr/bin/dpkg","--configure","-a"] |
274 | @@ -1208,7 +1210,7 @@ | |||
275 | 1208 | _("The upgrade has aborted. Please check your "\ | 1210 | _("The upgrade has aborted. Please check your "\ |
276 | 1209 | "Internet connection or "\ | 1211 | "Internet connection or "\ |
277 | 1210 | "installation media and try again. "), | 1212 | "installation media and try again. "), |
279 | 1211 | "%s" % e) | 1213 | "{0}".format(e)) |
280 | 1212 | # abort here because we want our sources.list back | 1214 | # abort here because we want our sources.list back |
281 | 1213 | self.abort() | 1215 | self.abort() |
282 | 1214 | 1216 | ||
283 | @@ -1301,7 +1303,7 @@ | |||
284 | 1301 | _("A problem occurred during the clean-up. " | 1303 | _("A problem occurred during the clean-up. " |
285 | 1302 | "Please see the below message for more " | 1304 | "Please see the below message for more " |
286 | 1303 | "information. "), | 1305 | "information. "), |
288 | 1304 | "%s" % e) | 1306 | "{0}".format(e)) |
289 | 1305 | # run stuff after cleanup | 1307 | # run stuff after cleanup |
290 | 1306 | self.quirks.run("PostCleanup") | 1308 | self.quirks.run("PostCleanup") |
291 | 1307 | # run the post upgrade scripts that can do fixup like xorg.conf | 1309 | # run the post upgrade scripts that can do fixup like xorg.conf |
292 | @@ -1375,8 +1377,8 @@ | |||
293 | 1375 | # FIXME: instead of error out, fetch and install it | 1377 | # FIXME: instead of error out, fetch and install it |
294 | 1376 | # here | 1378 | # here |
295 | 1377 | self._view.error(_("Required depends is not installed"), | 1379 | self._view.error(_("Required depends is not installed"), |
298 | 1378 | _("The required dependency '%s' is not " | 1380 | _("The required dependency '{0}' is not " |
299 | 1379 | "installed. " % dep)) | 1381 | "installed. ".format(dep))) |
300 | 1380 | sys.exit(1) | 1382 | sys.exit(1) |
301 | 1381 | return res | 1383 | return res |
302 | 1382 | 1384 | ||
303 | @@ -1755,7 +1757,7 @@ | |||
304 | 1755 | logging.error("No '%s' available/downloadable after sources.list rewrite+update" % pkg) | 1757 | logging.error("No '%s' available/downloadable after sources.list rewrite+update" % pkg) |
305 | 1756 | self._view.error(_("Invalid package information"), | 1758 | self._view.error(_("Invalid package information"), |
306 | 1757 | _("After updating your package " | 1759 | _("After updating your package " |
308 | 1758 | "information, the essential package '%s' " | 1760 | "information, the essential package '{0}' " |
309 | 1759 | "could not be located. This may be " | 1761 | "could not be located. This may be " |
310 | 1760 | "because you have no official mirrors " | 1762 | "because you have no official mirrors " |
311 | 1761 | "listed in your software sources, or " | 1763 | "listed in your software sources, or " |
312 | @@ -1765,8 +1767,7 @@ | |||
313 | 1765 | "software sources." | 1767 | "software sources." |
314 | 1766 | "\n" | 1768 | "\n" |
315 | 1767 | "In the case of an overloaded mirror, you " | 1769 | "In the case of an overloaded mirror, you " |
318 | 1768 | "may want to try the upgrade again later.") | 1770 | "may want to try the upgrade again later.").format(pkg)) |
317 | 1769 | % pkg) | ||
319 | 1770 | if os.path.exists("/usr/bin/apport-bug"): | 1771 | if os.path.exists("/usr/bin/apport-bug"): |
320 | 1771 | subprocess.Popen(["apport-bug", "ubuntu-release-upgrader-core"]) | 1772 | subprocess.Popen(["apport-bug", "ubuntu-release-upgrader-core"]) |
321 | 1772 | else: | 1773 | else: |
322 | 1773 | 1774 | ||
323 | === modified file 'DistUpgrade/DistUpgradeFetcherCore.py' | |||
324 | --- DistUpgrade/DistUpgradeFetcherCore.py 2014-02-25 00:14:50 +0000 | |||
325 | +++ DistUpgrade/DistUpgradeFetcherCore.py 2014-04-24 08:46:39 +0000 | |||
326 | @@ -72,9 +72,9 @@ | |||
327 | 72 | f = self.tmpdir + "/" + os.path.basename(self.new_dist.upgradeTool) | 72 | f = self.tmpdir + "/" + os.path.basename(self.new_dist.upgradeTool) |
328 | 73 | sig = self.tmpdir + "/" + os.path.basename( | 73 | sig = self.tmpdir + "/" + os.path.basename( |
329 | 74 | self.new_dist.upgradeToolSig) | 74 | self.new_dist.upgradeToolSig) |
333 | 75 | print(_("authenticate '%(file)s' against '%(signature)s' ") % { | 75 | print(_("authenticate '{file}' against '{signature}' ").format( |
334 | 76 | 'file': os.path.basename(f), | 76 | file=os.path.basename(f), |
335 | 77 | 'signature': os.path.basename(sig)}) | 77 | signature=os.path.basename(sig))) |
336 | 78 | if self.gpgauthenticate(f, sig): | 78 | if self.gpgauthenticate(f, sig): |
337 | 79 | return True | 79 | return True |
338 | 80 | return False | 80 | return False |
339 | @@ -136,7 +136,7 @@ | |||
340 | 136 | def extractDistUpgrader(self): | 136 | def extractDistUpgrader(self): |
341 | 137 | # extract the tarball | 137 | # extract the tarball |
342 | 138 | fname = os.path.join(self.tmpdir, os.path.basename(self.uri)) | 138 | fname = os.path.join(self.tmpdir, os.path.basename(self.uri)) |
344 | 139 | print(_("extracting '%s'") % os.path.basename(fname)) | 139 | print(_("extracting '{0}'").format(os.path.basename(fname))) |
345 | 140 | if not os.path.exists(fname): | 140 | if not os.path.exists(fname): |
346 | 141 | return False | 141 | return False |
347 | 142 | try: | 142 | try: |
348 | @@ -316,7 +316,7 @@ | |||
349 | 316 | return False | 316 | return False |
350 | 317 | else: | 317 | else: |
351 | 318 | self.error(_("Can not run the upgrade"), | 318 | self.error(_("Can not run the upgrade"), |
353 | 319 | _("The error message is '%s'.") % e.strerror) | 319 | _("The error message is '{0}'.").format(e.strerror)) |
354 | 320 | return True | 320 | return True |
355 | 321 | 321 | ||
356 | 322 | if __name__ == "__main__": | 322 | if __name__ == "__main__": |
357 | 323 | 323 | ||
358 | === modified file 'DistUpgrade/DistUpgradeFetcherKDE.py' | |||
359 | --- DistUpgrade/DistUpgradeFetcherKDE.py 2014-02-25 00:28:19 +0000 | |||
360 | +++ DistUpgrade/DistUpgradeFetcherKDE.py 2014-04-24 08:46:39 +0000 | |||
361 | @@ -157,18 +157,19 @@ | |||
362 | 157 | current_item = self.total_items | 157 | current_item = self.total_items |
363 | 158 | label_text = _("Downloading additional package files...") | 158 | label_text = _("Downloading additional package files...") |
364 | 159 | if self.current_cps > 0: | 159 | if self.current_cps > 0: |
366 | 160 | label_text += _("File %s of %s at %sB/s") % ( | 160 | label_text += _("File {0} of {1} at {2}B/s").format( |
367 | 161 | self.current_items, self.total_items, | 161 | self.current_items, self.total_items, |
368 | 162 | apt_pkg.size_to_str(self.current_cps)) | 162 | apt_pkg.size_to_str(self.current_cps)) |
369 | 163 | else: | 163 | else: |
371 | 164 | label_text += _("File %s of %s") % ( | 164 | label_text += _("File {0} of {1}").format( |
372 | 165 | self.current_items, self.total_items) | 165 | self.current_items, self.total_items) |
373 | 166 | self.label.setText(label_text) | 166 | self.label.setText(label_text) |
374 | 167 | KApplication.kApplication().processEvents() | 167 | KApplication.kApplication().processEvents() |
375 | 168 | return True | 168 | return True |
376 | 169 | 169 | ||
377 | 170 | def mediaChange(self, medium, drive): | 170 | def mediaChange(self, medium, drive): |
379 | 171 | msg = _("Please insert '%s' into the drive '%s'") % (medium, drive) | 171 | msg = _("Please insert '{0}' into the drive '{1}'").format( |
380 | 172 | medium, drive) | ||
381 | 172 | #change = QMessageBox.question(None, _("Media Change"), msg, | 173 | #change = QMessageBox.question(None, _("Media Change"), msg, |
382 | 173 | # QMessageBox.Ok, QMessageBox.Cancel) | 174 | # QMessageBox.Ok, QMessageBox.Cancel) |
383 | 174 | change = KMessageBox.questionYesNo(None, _("Media Change"), | 175 | change = KMessageBox.questionYesNo(None, _("Media Change"), |
384 | 175 | 176 | ||
385 | === modified file 'DistUpgrade/DistUpgradeGettext.py' | |||
386 | --- DistUpgrade/DistUpgradeGettext.py 2012-06-13 11:40:17 +0000 | |||
387 | +++ DistUpgrade/DistUpgradeGettext.py 2014-04-24 08:46:39 +0000 | |||
388 | @@ -64,7 +64,9 @@ | |||
389 | 64 | return "" | 64 | return "" |
390 | 65 | translated_msg = unicode_gettext(_translation(), message) | 65 | translated_msg = unicode_gettext(_translation(), message) |
391 | 66 | if not _verify(message, translated_msg): | 66 | if not _verify(message, translated_msg): |
393 | 67 | logging.error("incorrect translation for message '%s' to '%s' (wrong number of arguments)" % (message, translated_msg)) | 67 | logging.error( |
394 | 68 | "incorrect translation for message '{0}' to '{1}' " | ||
395 | 69 | "(wrong number of arguments)".format(message, translated_msg)) | ||
396 | 68 | return message | 70 | return message |
397 | 69 | return translated_msg | 71 | return translated_msg |
398 | 70 | 72 | ||
399 | @@ -75,7 +77,10 @@ | |||
400 | 75 | """ | 77 | """ |
401 | 76 | translated_msg = unicode_ngettext(_translation(), msgid1, msgid2, n) | 78 | translated_msg = unicode_ngettext(_translation(), msgid1, msgid2, n) |
402 | 77 | if not _verify(msgid1, translated_msg): | 79 | if not _verify(msgid1, translated_msg): |
404 | 78 | logging.error("incorrect translation for ngettext message '%s' plural: '%s' to '%s' (wrong number of arguments)" % (msgid1, msgid2, translated_msg)) | 80 | logging.error( |
405 | 81 | "incorrect translation for ngettext message '{0}' " | ||
406 | 82 | "plural: '{1}' to '{2}' (wrong number of arguments)".format( | ||
407 | 83 | msgid1, msgid2, translated_msg)) | ||
408 | 79 | # dumb fallback to not crash | 84 | # dumb fallback to not crash |
409 | 80 | if n == 1: | 85 | if n == 1: |
410 | 81 | return msgid1 | 86 | return msgid1 |
411 | 82 | 87 | ||
412 | === modified file 'DistUpgrade/DistUpgradeView.py' | |||
413 | --- DistUpgrade/DistUpgradeView.py 2014-04-14 16:16:56 +0000 | |||
414 | +++ DistUpgrade/DistUpgradeView.py 2014-04-24 08:46:39 +0000 | |||
415 | @@ -76,12 +76,12 @@ | |||
416 | 76 | # get the fragments, this is not ideal i18n wise, but its | 76 | # get the fragments, this is not ideal i18n wise, but its |
417 | 77 | # difficult to do it differently | 77 | # difficult to do it differently |
418 | 78 | if days > 0: | 78 | if days > 0: |
420 | 79 | map["str_days"] = ngettext("%li day","%li days", days) % days | 79 | map["str_days"] = ngettext("{0} day","{0} days", days).format(days) |
421 | 80 | if hours > 0: | 80 | if hours > 0: |
423 | 81 | map["str_hours"] = ngettext("%li hour","%li hours", hours) % hours | 81 | map["str_hours"] = ngettext("{0} hour","{0} hours", hours).format(hours) |
424 | 82 | if minutes > 0: | 82 | if minutes > 0: |
427 | 83 | map["str_minutes"] = ngettext("%li minute","%li minutes", minutes) % minutes | 83 | map["str_minutes"] = ngettext("{0} minute","{0} minutes", minutes).format(minutes) |
428 | 84 | map["str_seconds"] = ngettext("%li second","%li seconds", seconds) % seconds | 84 | map["str_seconds"] = ngettext("{0} second","{0} seconds", seconds).format(seconds) |
429 | 85 | 85 | ||
430 | 86 | # now assemble the string | 86 | # now assemble the string |
431 | 87 | if days > 0: | 87 | if days > 0: |
432 | @@ -97,7 +97,8 @@ | |||
433 | 97 | # plural form | 97 | # plural form |
434 | 98 | # | 98 | # |
435 | 99 | # Note: most western languages will not need to change this | 99 | # Note: most western languages will not need to change this |
437 | 100 | return _("%(str_days)s %(str_hours)s") % map | 100 | return _("{str_days} {str_hours}").format(str_days=map["str_days"], |
438 | 101 | str_hours=map["str_hours"]) | ||
439 | 101 | # display no minutes for time > 3h, see LP: #144455 | 102 | # display no minutes for time > 3h, see LP: #144455 |
440 | 102 | elif hours > 3: | 103 | elif hours > 3: |
441 | 103 | return map["str_hours"] | 104 | return map["str_hours"] |
442 | @@ -115,7 +116,9 @@ | |||
443 | 115 | # plural form | 116 | # plural form |
444 | 116 | # | 117 | # |
445 | 117 | # Note: most western languages will not need to change this | 118 | # Note: most western languages will not need to change this |
447 | 118 | return _("%(str_hours)s %(str_minutes)s") % map | 119 | return _("{str_hours} {str_minutes}").format( |
448 | 120 | str_hours=map["str_hours"], | ||
449 | 121 | str_minutes=map["str_minutes"]) | ||
450 | 119 | elif minutes > 0: | 122 | elif minutes > 0: |
451 | 120 | return map["str_minutes"] | 123 | return map["str_minutes"] |
452 | 121 | return map["str_seconds"] | 124 | return map["str_seconds"] |
453 | @@ -166,11 +169,11 @@ | |||
454 | 166 | if self.est_speed == 0: | 169 | if self.est_speed == 0: |
455 | 167 | timeModem = required_download/(56*1024/8) # 56 kbit | 170 | timeModem = required_download/(56*1024/8) # 56 kbit |
456 | 168 | timeDSL = required_download/(1024*1024/8) # 1Mbit = 1024 kbit | 171 | timeDSL = required_download/(1024*1024/8) # 1Mbit = 1024 kbit |
459 | 169 | s= _("This download will take about %s with a 1Mbit DSL connection " | 172 | s= _("This download will take about {0} with a 1Mbit DSL connection " |
460 | 170 | "and about %s with a 56k modem.") % (FuzzyTimeToStr(timeDSL), FuzzyTimeToStr(timeModem)) | 173 | "and about {1} with a 56k modem.").format(FuzzyTimeToStr(timeDSL), FuzzyTimeToStr(timeModem)) |
461 | 171 | return s | 174 | return s |
462 | 172 | # if we have a estimated speed, use it | 175 | # if we have a estimated speed, use it |
464 | 173 | s = _("This download will take about %s with your connection. ") % FuzzyTimeToStr(required_download/self.est_speed) | 176 | s = _("This download will take about {0} with your connection. ").format(FuzzyTimeToStr(required_download/self.est_speed)) |
465 | 174 | return s | 177 | return s |
466 | 175 | 178 | ||
467 | 176 | 179 | ||
468 | @@ -366,35 +369,35 @@ | |||
469 | 366 | # FIXME: show detailed packages | 369 | # FIXME: show detailed packages |
470 | 367 | if len(self.demotions) > 0: | 370 | if len(self.demotions) > 0: |
471 | 368 | msg += ngettext( | 371 | msg += ngettext( |
477 | 369 | "%(amount)d installed package is no longer supported by Canonical. " | 372 | "{amount} installed package is no longer supported by Canonical. " |
478 | 370 | "You can still get support from the community.", | 373 | "You can still get support from the community.", |
479 | 371 | "%(amount)d installed packages are no longer supported by " | 374 | "{amount} installed packages are no longer supported by " |
480 | 372 | "Canonical. You can still get support from the community.", | 375 | "Canonical. You can still get support from the community.", |
481 | 373 | len(self.demotions)) % { 'amount' : len(self.demotions) } | 376 | len(self.demotions)).format(amount=len(self.demotions)) |
482 | 374 | msg += "\n\n" | 377 | msg += "\n\n" |
483 | 375 | if pkgs_remove > 0: | 378 | if pkgs_remove > 0: |
484 | 376 | # FIXME: make those two separate lines to make it clear | 379 | # FIXME: make those two separate lines to make it clear |
485 | 377 | # that the "%" applies to the result of ngettext | 380 | # that the "%" applies to the result of ngettext |
489 | 378 | msg += ngettext("%d package is going to be removed.", | 381 | msg += ngettext("{0} package is going to be removed.", |
490 | 379 | "%d packages are going to be removed.", | 382 | "{0} packages are going to be removed.", |
491 | 380 | pkgs_remove) % pkgs_remove | 383 | pkgs_remove).format(pkgs_remove) |
492 | 381 | msg += " " | 384 | msg += " " |
493 | 382 | if pkgs_inst > 0: | 385 | if pkgs_inst > 0: |
495 | 383 | msg += ngettext("%d new package is going to be " | 386 | msg += ngettext("{0} new package is going to be " |
496 | 384 | "installed.", | 387 | "installed.", |
499 | 385 | "%d new packages are going to be " | 388 | "{0} new packages are going to be " |
500 | 386 | "installed.",pkgs_inst) % pkgs_inst | 389 | "installed.",pkgs_inst).format(pkgs_inst) |
501 | 387 | msg += " " | 390 | msg += " " |
502 | 388 | if pkgs_upgrade > 0: | 391 | if pkgs_upgrade > 0: |
506 | 389 | msg += ngettext("%d package is going to be upgraded.", | 392 | msg += ngettext("{0} package is going to be upgraded.", |
507 | 390 | "%d packages are going to be upgraded.", | 393 | "{0} packages are going to be upgraded.", |
508 | 391 | pkgs_upgrade) % pkgs_upgrade | 394 | pkgs_upgrade).format(pkgs_upgrade) |
509 | 392 | msg +=" " | 395 | msg +=" " |
510 | 393 | if downloadSize > 0: | 396 | if downloadSize > 0: |
511 | 394 | downloadSizeStr = apt_pkg.size_to_str(downloadSize) | 397 | downloadSizeStr = apt_pkg.size_to_str(downloadSize) |
512 | 395 | if isinstance(downloadSizeStr, bytes): | 398 | if isinstance(downloadSizeStr, bytes): |
513 | 396 | downloadSizeStr = downloadSizeStr.decode(ENCODING) | 399 | downloadSizeStr = downloadSizeStr.decode(ENCODING) |
515 | 397 | msg += _("\n\nYou have to download a total of %s. ") % ( | 400 | msg += _("\n\nYou have to download a total of {0}. ").format( |
516 | 398 | downloadSizeStr) | 401 | downloadSizeStr) |
517 | 399 | msg += self.getAcquireProgress().estimatedDownloadTime(downloadSize) | 402 | msg += self.getAcquireProgress().estimatedDownloadTime(downloadSize) |
518 | 400 | if ((pkgs_upgrade + pkgs_inst) > 0) and ((pkgs_upgrade + pkgs_inst + pkgs_remove) > 100): | 403 | if ((pkgs_upgrade + pkgs_inst) > 0) and ((pkgs_upgrade + pkgs_inst + pkgs_remove) > 100): |
519 | 401 | 404 | ||
520 | === modified file 'DistUpgrade/DistUpgradeViewGtk3.py' | |||
521 | --- DistUpgrade/DistUpgradeViewGtk3.py 2014-04-24 08:42:34 +0000 | |||
522 | +++ DistUpgrade/DistUpgradeViewGtk3.py 2014-04-24 08:46:39 +0000 | |||
523 | @@ -112,7 +112,7 @@ | |||
524 | 112 | self.canceled = True | 112 | self.canceled = True |
525 | 113 | def media_change(self, medium, drive): | 113 | def media_change(self, medium, drive): |
526 | 114 | #print("mediaChange %s %s" % (medium, drive)) | 114 | #print("mediaChange %s %s" % (medium, drive)) |
528 | 115 | msg = _("Please insert '%s' into the drive '%s'") % (medium,drive) | 115 | msg = _("Please insert '{0}' into the drive '{0}'").format(medium,drive) |
529 | 116 | dialog = Gtk.MessageDialog(parent=self.parent.window_main, | 116 | dialog = Gtk.MessageDialog(parent=self.parent.window_main, |
530 | 117 | flags=Gtk.DialogFlags.MODAL, | 117 | flags=Gtk.DialogFlags.MODAL, |
531 | 118 | type=Gtk.MessageType.QUESTION, | 118 | type=Gtk.MessageType.QUESTION, |
532 | @@ -148,12 +148,13 @@ | |||
533 | 148 | if isinstance(current_cps, bytes): | 148 | if isinstance(current_cps, bytes): |
534 | 149 | current_cps = current_cps.decode( | 149 | current_cps = current_cps.decode( |
535 | 150 | locale.getpreferredencoding()) | 150 | locale.getpreferredencoding()) |
540 | 151 | self.status.set_text(_("Fetching file %li of %li at %sB/s") % ( | 151 | self.status.set_text( |
541 | 152 | currentItem, self.total_items, current_cps)) | 152 | _("Fetching file {0} of {1} at {2}B/s").format( |
542 | 153 | self.progress.set_text(_("About %s remaining") % FuzzyTimeToStr( | 153 | currentItem, self.total_items, current_cps)) |
543 | 154 | self.eta)) | 154 | self.progress.set_text(_("About {0} remaining").format( |
544 | 155 | FuzzyTimeToStr(self.eta))) | ||
545 | 155 | else: | 156 | else: |
547 | 156 | self.status.set_text(_("Fetching file %li of %li") % ( | 157 | self.status.set_text(_("Fetching file {0} of {1}").format( |
548 | 157 | currentItem, self.total_items)) | 158 | currentItem, self.total_items)) |
549 | 158 | self.progress.set_text(" ") | 159 | self.progress.set_text(" ") |
550 | 159 | while Gtk.events_pending(): | 160 | while Gtk.events_pending(): |
551 | @@ -215,11 +216,11 @@ | |||
552 | 215 | 216 | ||
553 | 216 | #self.expander_terminal.set_expanded(True) | 217 | #self.expander_terminal.set_expanded(True) |
554 | 217 | self.parent.dialog_error.set_transient_for(self.parent.window_main) | 218 | self.parent.dialog_error.set_transient_for(self.parent.window_main) |
557 | 218 | summary = _("Could not install '%s'") % pkg | 219 | summary = _("Could not install '{0}'").format(pkg) |
558 | 219 | msg = _("The upgrade will continue but the '%s' package may not " | 220 | msg = _("The upgrade will continue but the '{0}' package may not " |
559 | 220 | "be in a working state. Please consider submitting a " | 221 | "be in a working state. Please consider submitting a " |
562 | 221 | "bug report about it.") % pkg | 222 | "bug report about it.").format(pkg) |
563 | 222 | markup="<big><b>%s</b></big>\n\n%s" % (summary, msg) | 223 | markup="<big><b>{0}</b></big>\n\n{1}".format(summary, msg) |
564 | 223 | self.parent.dialog_error.realize() | 224 | self.parent.dialog_error.realize() |
565 | 224 | self.parent.dialog_error.set_title("") | 225 | self.parent.dialog_error.set_title("") |
566 | 225 | self.parent.dialog_error.get_window().set_functions(Gdk.WMFunction.MOVE) | 226 | self.parent.dialog_error.get_window().set_functions(Gdk.WMFunction.MOVE) |
567 | @@ -233,11 +234,12 @@ | |||
568 | 233 | logging.debug("got a conffile-prompt from dpkg for file: '%s'" % current) | 234 | logging.debug("got a conffile-prompt from dpkg for file: '%s'" % current) |
569 | 234 | start = time.time() | 235 | start = time.time() |
570 | 235 | #self.expander.set_expanded(True) | 236 | #self.expander.set_expanded(True) |
572 | 236 | prim = _("Replace the customized configuration file\n'%s'?") % current | 237 | prim = _("Replace the customized configuration file\n'{0}'?").format( |
573 | 238 | current) | ||
574 | 237 | sec = _("You will lose any changes you have made to this " | 239 | sec = _("You will lose any changes you have made to this " |
575 | 238 | "configuration file if you choose to replace it with " | 240 | "configuration file if you choose to replace it with " |
576 | 239 | "a newer version.") | 241 | "a newer version.") |
578 | 240 | markup = "<span weight=\"bold\" size=\"larger\">%s </span> \n\n%s" % (prim, sec) | 242 | markup = "<span weight=\"bold\" size=\"larger\">{0} </span> \n\n{1}".format(prim, sec) |
579 | 241 | self.parent.label_conffile.set_markup(markup) | 243 | self.parent.label_conffile.set_markup(markup) |
580 | 242 | self.parent.dialog_conffile.set_title("") | 244 | self.parent.dialog_conffile.set_title("") |
581 | 243 | self.parent.dialog_conffile.set_transient_for(self.parent.window_main) | 245 | self.parent.dialog_conffile.set_transient_for(self.parent.window_main) |
582 | @@ -254,7 +256,8 @@ | |||
583 | 254 | diff = diff.decode("UTF-8", "replace") | 256 | diff = diff.decode("UTF-8", "replace") |
584 | 255 | self.parent.textview_conffile.get_buffer().set_text(diff) | 257 | self.parent.textview_conffile.get_buffer().set_text(diff) |
585 | 256 | else: | 258 | else: |
587 | 257 | self.parent.textview_conffile.get_buffer().set_text(_("The 'diff' command was not found")) | 259 | self.parent.textview_conffile.get_buffer().set_text( |
588 | 260 | _("The 'diff' command was not found")) | ||
589 | 258 | res = self.parent.dialog_conffile.run() | 261 | res = self.parent.dialog_conffile.run() |
590 | 259 | self.parent.dialog_conffile.hide() | 262 | self.parent.dialog_conffile.hide() |
591 | 260 | self.time_ui += time.time() - start | 263 | self.time_ui += time.time() - start |
592 | @@ -307,7 +310,8 @@ | |||
593 | 307 | eta = (100.0 - percent) * time_per_percent | 310 | eta = (100.0 - percent) * time_per_percent |
594 | 308 | # only show if we have some sensible data (60sec < eta < 2days) | 311 | # only show if we have some sensible data (60sec < eta < 2days) |
595 | 309 | if eta > 61.0 and eta < (60*60*24*2): | 312 | if eta > 61.0 and eta < (60*60*24*2): |
597 | 310 | self.progress.set_text(_("About %s remaining") % FuzzyTimeToStr(eta)) | 313 | self.progress.set_text( |
598 | 314 | _("About {0} remaining").format(FuzzyTimeToStr(eta))) | ||
599 | 311 | else: | 315 | else: |
600 | 312 | self.progress.set_text(" ") | 316 | self.progress.set_text(" ") |
601 | 313 | # 2 == WEBKIT_LOAD_FINISHED - the enums is not exposed via python | 317 | # 2 == WEBKIT_LOAD_FINISHED - the enums is not exposed via python |
602 | @@ -652,16 +656,16 @@ | |||
603 | 652 | # fill in the details | 656 | # fill in the details |
604 | 653 | self.details_list.clear() | 657 | self.details_list.clear() |
605 | 654 | for (parent_text, details_list) in ( | 658 | for (parent_text, details_list) in ( |
612 | 655 | ( _("No longer supported by Canonical (%s)"), self.demotions), | 659 | ( _("No longer supported by Canonical ({0})"), self.demotions), |
613 | 656 | ( _("<b>Downgrade (%s)</b>"), self.toDowngrade), | 660 | ( _("<b>Downgrade ({0})</b>"), self.toDowngrade), |
614 | 657 | ( _("Remove (%s)"), self.toRemove), | 661 | ( _("Remove ({0})"), self.toRemove), |
615 | 658 | ( _("No longer needed (%s)"), self.toRemoveAuto), | 662 | ( _("No longer needed ({0})"), self.toRemoveAuto), |
616 | 659 | ( _("Install (%s)"), self.toInstall), | 663 | ( _("Install ({0})"), self.toInstall), |
617 | 660 | ( _("Upgrade (%s)"), self.toUpgrade), | 664 | ( _("Upgrade ({0})"), self.toUpgrade), |
618 | 661 | ): | 665 | ): |
619 | 662 | if details_list: | 666 | if details_list: |
620 | 663 | node = self.details_list.append(None, | 667 | node = self.details_list.append(None, |
622 | 664 | [parent_text % len(details_list)]) | 668 | [parent_text.format(len(details_list))]) |
623 | 665 | for pkg in details_list: | 669 | for pkg in details_list: |
624 | 666 | self.details_list.append(node, ["<b>%s</b> - %s" % ( | 670 | self.details_list.append(node, ["<b>%s</b> - %s" % ( |
625 | 667 | pkg.name, GLib.markup_escape_text(getattr(pkg.candidate, "summary", None)))]) | 671 | pkg.name, GLib.markup_escape_text(getattr(pkg.candidate, "summary", None)))]) |
626 | 668 | 672 | ||
627 | === modified file 'DistUpgrade/DistUpgradeViewKDE.py' | |||
628 | --- DistUpgrade/DistUpgradeViewKDE.py 2012-10-09 16:35:12 +0000 | |||
629 | +++ DistUpgrade/DistUpgradeViewKDE.py 2014-04-24 08:46:39 +0000 | |||
630 | @@ -193,7 +193,7 @@ | |||
631 | 193 | self.parent = parent | 193 | self.parent = parent |
632 | 194 | 194 | ||
633 | 195 | def media_change(self, medium, drive): | 195 | def media_change(self, medium, drive): |
635 | 196 | msg = _("Please insert '%s' into the drive '%s'") % (medium,drive) | 196 | msg = _("Please insert '{0}' into the drive '{1}'").format(medium,drive) |
636 | 197 | change = QMessageBox.question(self.parent.window_main, _("Media Change"), msg, QMessageBox.Ok, QMessageBox.Cancel) | 197 | change = QMessageBox.question(self.parent.window_main, _("Media Change"), msg, QMessageBox.Ok, QMessageBox.Cancel) |
637 | 198 | if change == QMessageBox.Ok: | 198 | if change == QMessageBox.Ok: |
638 | 199 | return True | 199 | return True |
639 | @@ -223,10 +223,15 @@ | |||
640 | 223 | current_cps = apt_pkg.size_to_str(self.current_cps) | 223 | current_cps = apt_pkg.size_to_str(self.current_cps) |
641 | 224 | if isinstance(current_cps, bytes): | 224 | if isinstance(current_cps, bytes): |
642 | 225 | current_cps = current_cps.decode(locale.getpreferredencoding()) | 225 | current_cps = current_cps.decode(locale.getpreferredencoding()) |
645 | 226 | self.status.setText(_("Fetching file %li of %li at %sB/s") % (current_item, self.total_items, current_cps)) | 226 | self.status.setText(_("Fetching file {0} of {1} at {2}B/s").format( |
646 | 227 | self.parent.window_main.progress_text.setText("<i>" + _("About %s remaining") % FuzzyTimeToStr(self.eta) + "</i>") | 227 | current_item, self.total_items, current_cps)) |
647 | 228 | self.parent.window_main.progress_text.setText( | ||
648 | 229 | "<i>" + _("About {0} remaining").format( | ||
649 | 230 | FuzzyTimeToStr(self.eta)) + | ||
650 | 231 | "</i>") | ||
651 | 228 | else: | 232 | else: |
653 | 229 | self.status.setText(_("Fetching file %li of %li") % (current_item, self.total_items)) | 233 | self.status.setText(_("Fetching file {0} of {1}").format( |
654 | 234 | current_item, self.total_items)) | ||
655 | 230 | self.parent.window_main.progress_text.setText(" ") | 235 | self.parent.window_main.progress_text.setText(" ") |
656 | 231 | 236 | ||
657 | 232 | QApplication.processEvents() | 237 | QApplication.processEvents() |
658 | @@ -278,10 +283,10 @@ | |||
659 | 278 | # we do not report followup errors from earlier failures | 283 | # we do not report followup errors from earlier failures |
660 | 279 | if gettext.dgettext('dpkg', "dependency problems - leaving unconfigured") in errormsg: | 284 | if gettext.dgettext('dpkg', "dependency problems - leaving unconfigured") in errormsg: |
661 | 280 | return False | 285 | return False |
664 | 281 | summary = _("Could not install '%s'") % pkg | 286 | summary = _("Could not install '{0}'").format(pkg) |
665 | 282 | msg = _("The upgrade will continue but the '%s' package may not " | 287 | msg = _("The upgrade will continue but the '{0}' package may not " |
666 | 283 | "be in a working state. Please consider submitting a " | 288 | "be in a working state. Please consider submitting a " |
668 | 284 | "bug report about it.") % pkg | 289 | "bug report about it.").format(pkg) |
669 | 285 | msg = "<big><b>%s</b></big><br />%s" % (summary, msg) | 290 | msg = "<big><b>%s</b></big><br />%s" % (summary, msg) |
670 | 286 | 291 | ||
671 | 287 | dialogue = QDialog(self.parent.window_main) | 292 | dialogue = QDialog(self.parent.window_main) |
672 | @@ -300,11 +305,13 @@ | |||
673 | 300 | """ask question in case conffile has been changed by user""" | 305 | """ask question in case conffile has been changed by user""" |
674 | 301 | logging.debug("got a conffile-prompt from dpkg for file: '%s'" % current) | 306 | logging.debug("got a conffile-prompt from dpkg for file: '%s'" % current) |
675 | 302 | start = time.time() | 307 | start = time.time() |
677 | 303 | prim = _("Replace the customized configuration file\n'%s'?") % current | 308 | prim = _("Replace the customized configuration file\n'{0}'?").format( |
678 | 309 | current) | ||
679 | 304 | sec = _("You will lose any changes you have made to this " | 310 | sec = _("You will lose any changes you have made to this " |
680 | 305 | "configuration file if you choose to replace it with " | 311 | "configuration file if you choose to replace it with " |
681 | 306 | "a newer version.") | 312 | "a newer version.") |
683 | 307 | markup = "<span weight=\"bold\" size=\"larger\">%s </span> \n\n%s" % (prim, sec) | 313 | markup = "<span weight=\"bold\" size=\"larger\">{0} </span> "\ |
684 | 314 | "\n\n{1}".format(prim, sec) | ||
685 | 308 | self.confDialogue = QDialog(self.parent.window_main) | 315 | self.confDialogue = QDialog(self.parent.window_main) |
686 | 309 | loadUi("dialog_conffile.ui", self.confDialogue) | 316 | loadUi("dialog_conffile.ui", self.confDialogue) |
687 | 310 | self.confDialogue.label_conffile.setText(markup) | 317 | self.confDialogue.label_conffile.setText(markup) |
688 | @@ -372,7 +379,8 @@ | |||
689 | 372 | eta = (100.0 - self.percent) * time_per_percent | 379 | eta = (100.0 - self.percent) * time_per_percent |
690 | 373 | # only show if we have some sensible data (60sec < eta < 2days) | 380 | # only show if we have some sensible data (60sec < eta < 2days) |
691 | 374 | if eta > 61.0 and eta < (60*60*24*2): | 381 | if eta > 61.0 and eta < (60*60*24*2): |
693 | 375 | self.progress_text.setText(_("About %s remaining") % FuzzyTimeToStr(eta)) | 382 | self.progress_text.setText(_("About {0} remaining").format( |
694 | 383 | FuzzyTimeToStr(eta))) | ||
695 | 376 | else: | 384 | else: |
696 | 377 | self.progress_text.setText(" ") | 385 | self.progress_text.setText(" ") |
697 | 378 | 386 | ||
698 | @@ -778,15 +786,15 @@ | |||
699 | 778 | self.changesDialogue.treeview_details.setHeaderLabels(["Packages"]) | 786 | self.changesDialogue.treeview_details.setHeaderLabels(["Packages"]) |
700 | 779 | self.changesDialogue.treeview_details.header().hide() | 787 | self.changesDialogue.treeview_details.header().hide() |
701 | 780 | for demoted in self.demotions: | 788 | for demoted in self.demotions: |
703 | 781 | self.changesDialogue.treeview_details.insertTopLevelItem(0, QTreeWidgetItem(self.changesDialogue.treeview_details, [_("No longer supported %s") % demoted.name]) ) | 789 | self.changesDialogue.treeview_details.insertTopLevelItem(0, QTreeWidgetItem(self.changesDialogue.treeview_details, [_("No longer supported {0}").format(demoted.name)]) ) |
704 | 782 | for rm in self.toRemove: | 790 | for rm in self.toRemove: |
706 | 783 | self.changesDialogue.treeview_details.insertTopLevelItem(0, QTreeWidgetItem(self.changesDialogue.treeview_details, [_("Remove %s") % rm.name]) ) | 791 | self.changesDialogue.treeview_details.insertTopLevelItem(0, QTreeWidgetItem(self.changesDialogue.treeview_details, [_("Remove {0}").format(rm.name)]) ) |
707 | 784 | for rm in self.toRemoveAuto: | 792 | for rm in self.toRemoveAuto: |
709 | 785 | self.changesDialogue.treeview_details.insertTopLevelItem(0, QTreeWidgetItem(self.changesDialogue.treeview_details, [_("Remove (was auto installed) %s") % rm.name]) ) | 793 | self.changesDialogue.treeview_details.insertTopLevelItem(0, QTreeWidgetItem(self.changesDialogue.treeview_details, [_("Remove (was auto installed) {0}").format(rm.name)]) ) |
710 | 786 | for inst in self.toInstall: | 794 | for inst in self.toInstall: |
712 | 787 | self.changesDialogue.treeview_details.insertTopLevelItem(0, QTreeWidgetItem(self.changesDialogue.treeview_details, [_("Install %s") % inst.name]) ) | 795 | self.changesDialogue.treeview_details.insertTopLevelItem(0, QTreeWidgetItem(self.changesDialogue.treeview_details, [_("Install {0}").format(inst.name)]) ) |
713 | 788 | for up in self.toUpgrade: | 796 | for up in self.toUpgrade: |
715 | 789 | self.changesDialogue.treeview_details.insertTopLevelItem(0, QTreeWidgetItem(self.changesDialogue.treeview_details, [_("Upgrade %s") % up.name]) ) | 797 | self.changesDialogue.treeview_details.insertTopLevelItem(0, QTreeWidgetItem(self.changesDialogue.treeview_details, [_("Upgrade {0}").format(up.name)]) ) |
716 | 790 | 798 | ||
717 | 791 | #FIXME resize label, stop it being shrinkable | 799 | #FIXME resize label, stop it being shrinkable |
718 | 792 | res = self.changesDialogue.exec_() | 800 | res = self.changesDialogue.exec_() |
719 | 793 | 801 | ||
720 | === modified file 'DistUpgrade/DistUpgradeViewText.py' | |||
721 | --- DistUpgrade/DistUpgradeViewText.py 2014-04-14 12:14:57 +0000 | |||
722 | +++ DistUpgrade/DistUpgradeViewText.py 2014-04-24 08:46:39 +0000 | |||
723 | @@ -196,27 +196,32 @@ | |||
724 | 196 | if len(self.demotions) > 0: | 196 | if len(self.demotions) > 0: |
725 | 197 | output += "\n" | 197 | output += "\n" |
726 | 198 | output += twrap( | 198 | output += twrap( |
728 | 199 | _("No longer supported: %s\n") % " ".join([p.name for p in self.demotions]), | 199 | _("No longer supported: {0}\n").format( |
729 | 200 | " ".join([p.name for p in self.demotions])), | ||
730 | 200 | subsequent_indent=' ') | 201 | subsequent_indent=' ') |
731 | 201 | if len(self.toRemove) > 0: | 202 | if len(self.toRemove) > 0: |
732 | 202 | output += "\n" | 203 | output += "\n" |
733 | 203 | output += twrap( | 204 | output += twrap( |
735 | 204 | _("Remove: %s\n") % " ".join([p.name for p in self.toRemove]), | 205 | _("Remove: {0}\n").format( |
736 | 206 | " ".join([p.name for p in self.toRemove])), | ||
737 | 205 | subsequent_indent=' ') | 207 | subsequent_indent=' ') |
738 | 206 | if len(self.toRemoveAuto) > 0: | 208 | if len(self.toRemoveAuto) > 0: |
739 | 207 | output += twrap( | 209 | output += twrap( |
741 | 208 | _("Remove (was auto installed) %s") % " ".join([p.name for p in self.toRemoveAuto]), | 210 | _("Remove (was auto installed) {0}").format( |
742 | 211 | " ".join([p.name for p in self.toRemoveAuto])), | ||
743 | 209 | subsequent_indent=' ') | 212 | subsequent_indent=' ') |
744 | 210 | output += "\n" | 213 | output += "\n" |
745 | 211 | if len(self.toInstall) > 0: | 214 | if len(self.toInstall) > 0: |
746 | 212 | output += "\n" | 215 | output += "\n" |
747 | 213 | output += twrap( | 216 | output += twrap( |
749 | 214 | _("Install: %s\n") % " ".join([p.name for p in self.toInstall]), | 217 | _("Install: {0}\n").format( |
750 | 218 | " ".join([p.name for p in self.toInstall])), | ||
751 | 215 | subsequent_indent=' ') | 219 | subsequent_indent=' ') |
752 | 216 | if len(self.toUpgrade) > 0: | 220 | if len(self.toUpgrade) > 0: |
753 | 217 | output += "\n" | 221 | output += "\n" |
754 | 218 | output += twrap( | 222 | output += twrap( |
756 | 219 | _("Upgrade: %s\n") % " ".join([p.name for p in self.toUpgrade]), | 223 | _("Upgrade: {0}\n").format( |
757 | 224 | " ".join([p.name for p in self.toUpgrade])), | ||
758 | 220 | subsequent_indent=' ') | 225 | subsequent_indent=' ') |
759 | 221 | self.showInPager(output) | 226 | self.showInPager(output) |
760 | 222 | print("%s %s" % (_("Continue [yN] "), _("Details [d]")), end="") | 227 | print("%s %s" % (_("Continue [yN] "), _("Details [d]")), end="") |
761 | 223 | 228 | ||
762 | === modified file 'DistUpgrade/GtkProgress.py' | |||
763 | --- DistUpgrade/GtkProgress.py 2013-01-15 15:51:10 +0000 | |||
764 | +++ DistUpgrade/GtkProgress.py 2014-04-24 08:46:39 +0000 | |||
765 | @@ -70,15 +70,15 @@ | |||
766 | 70 | if current_item > self.total_items: | 70 | if current_item > self.total_items: |
767 | 71 | current_item = self.total_items | 71 | current_item = self.total_items |
768 | 72 | if self.current_cps > 0: | 72 | if self.current_cps > 0: |
774 | 73 | status_text = (_("Downloading file %(current)li of %(total)li " | 73 | status_text = (_("Downloading file {current} of {total} " |
775 | 74 | "with %(speed)s/s") % { | 74 | "with {speed}/s").format( |
776 | 75 | "current": current_item, | 75 | current=current_item, |
777 | 76 | "total": self.total_items, | 76 | total=self.total_items, |
778 | 77 | "speed": humanize_size(self.current_cps)}) | 77 | speed=humanize_size(self.current_cps))) |
779 | 78 | else: | 78 | else: |
783 | 79 | status_text = (_("Downloading file %(current)li of %(total)li") % | 79 | status_text = (_("Downloading file {current} of {total}").format( |
784 | 80 | {"current": current_item, | 80 | current=current_item, |
785 | 81 | "total": self.total_items}) | 81 | total=self.total_items)) |
786 | 82 | self.progress.set_fraction( | 82 | self.progress.set_fraction( |
787 | 83 | (self.current_bytes + self.current_items) / | 83 | (self.current_bytes + self.current_items) / |
788 | 84 | float(self.total_bytes + self.total_items)) | 84 | float(self.total_bytes + self.total_items)) |
789 | 85 | 85 | ||
790 | === modified file 'check-new-release-gtk' | |||
791 | --- check-new-release-gtk 2013-10-05 02:17:39 +0000 | |||
792 | +++ check-new-release-gtk 2014-04-24 08:46:39 +0000 | |||
793 | @@ -73,7 +73,7 @@ | |||
794 | 73 | self.options = options | 73 | self.options = options |
795 | 74 | self.datadir = options.datadir | 74 | self.datadir = options.datadir |
796 | 75 | self.new_dist = None | 75 | self.new_dist = None |
798 | 76 | logging.debug("running with devel=%s proposed=%s" % ( | 76 | logging.debug("running with devel={0} proposed={0}".format( |
799 | 77 | options.devel_release, options.proposed_release)) | 77 | options.devel_release, options.proposed_release)) |
800 | 78 | m = MetaRelease(useDevelopmentRelease=options.devel_release, | 78 | m = MetaRelease(useDevelopmentRelease=options.devel_release, |
801 | 79 | useProposed=options.proposed_release) | 79 | useProposed=options.proposed_release) |
802 | @@ -93,7 +93,7 @@ | |||
803 | 93 | Gtk.main() | 93 | Gtk.main() |
804 | 94 | 94 | ||
805 | 95 | def new_dist_available(self, meta_release, new_dist): | 95 | def new_dist_available(self, meta_release, new_dist): |
807 | 96 | logging.debug("new_dist_available: %s" % new_dist) | 96 | logging.debug("new_dist_available: {0}".format(new_dist)) |
808 | 97 | self.new_dist = new_dist | 97 | self.new_dist = new_dist |
809 | 98 | client = Gio.Settings("com.ubuntu.update-manager") | 98 | client = Gio.Settings("com.ubuntu.update-manager") |
810 | 99 | ignore_dist = client.get_string("check-new-release-ignore") | 99 | ignore_dist = client.get_string("check-new-release-ignore") |
811 | @@ -101,7 +101,7 @@ | |||
812 | 101 | # go into nag mode | 101 | # go into nag mode |
813 | 102 | if (ignore_dist == new_dist.name and | 102 | if (ignore_dist == new_dist.name and |
814 | 103 | meta_release.no_longer_supported is None): | 103 | meta_release.no_longer_supported is None): |
816 | 104 | logging.warn("found new dist '%s' but it is on the ignore list" % new_dist.name) | 104 | logging.warn("found new dist '{0}' but it is on the ignore list".format(new_dist.name)) |
817 | 105 | sys.exit() | 105 | sys.exit() |
818 | 106 | 106 | ||
819 | 107 | # show alert on unsupported distros | 107 | # show alert on unsupported distros |
820 | @@ -110,7 +110,7 @@ | |||
821 | 110 | Gtk.main_quit() | 110 | Gtk.main_quit() |
822 | 111 | else: | 111 | else: |
823 | 112 | self.build_ui() | 112 | self.build_ui() |
825 | 113 | self.window_main.set_title(_("Ubuntu %(version)s Upgrade Available") % {'version': new_dist.version}) | 113 | self.window_main.set_title(_("Ubuntu {version} Upgrade Available").format(version=new_dist.version)) |
826 | 114 | self.window_main.show() | 114 | self.window_main.show() |
827 | 115 | 115 | ||
828 | 116 | def close(self): | 116 | def close(self): |
829 | @@ -129,7 +129,7 @@ | |||
830 | 129 | extra_args = extra_args + " --proposed" | 129 | extra_args = extra_args + " --proposed" |
831 | 130 | os.execl("/bin/sh", "/bin/sh", "-c", | 130 | os.execl("/bin/sh", "/bin/sh", "-c", |
832 | 131 | "/usr/bin/pkexec /usr/bin/do-release-upgrade " | 131 | "/usr/bin/pkexec /usr/bin/do-release-upgrade " |
834 | 132 | "--frontend=DistUpgradeViewGtk3%s" % extra_args) | 132 | "--frontend=DistUpgradeViewGtk3{0}".format(extra_args)) |
835 | 133 | 133 | ||
836 | 134 | def on_button_ask_me_later_clicked(self, button): | 134 | def on_button_ask_me_later_clicked(self, button): |
837 | 135 | logging.debug("ask me later") | 135 | logging.debug("ask me later") |
838 | @@ -141,8 +141,9 @@ | |||
839 | 141 | 141 | ||
840 | 142 | def on_button_dont_upgrade_clicked(self, button): | 142 | def on_button_dont_upgrade_clicked(self, button): |
841 | 143 | #print("don't upgrade") | 143 | #print("don't upgrade") |
844 | 144 | s = _("You have declined the upgrade to Ubuntu %s") % self.new_dist.version | 144 | s = _("You have declined the upgrade to Ubuntu {0}").format( |
845 | 145 | self.dialog_really_do_not_upgrade.set_markup("<b>%s</b>" % s) | 145 | self.new_dist.version) |
846 | 146 | self.dialog_really_do_not_upgrade.set_markup("<b>{0}</b>".format(s)) | ||
847 | 146 | if self.dialog_really_do_not_upgrade.run() == Gtk.ResponseType.OK: | 147 | if self.dialog_really_do_not_upgrade.run() == Gtk.ResponseType.OK: |
848 | 147 | client = Gio.Settings("com.ubuntu.update-manager") | 148 | client = Gio.Settings("com.ubuntu.update-manager") |
849 | 148 | client.set_string("check-new-release-ignore", self.new_dist.name) | 149 | client.set_string("check-new-release-ignore", self.new_dist.name) |
850 | 149 | 150 | ||
851 | === modified file 'do-partial-upgrade' | |||
852 | --- do-partial-upgrade 2012-06-28 19:22:04 +0000 | |||
853 | +++ do-partial-upgrade 2014-04-24 08:46:39 +0000 | |||
854 | @@ -77,7 +77,7 @@ | |||
855 | 77 | data_dir = os.path.normpath(options.data_dir)+"/" | 77 | data_dir = os.path.normpath(options.data_dir)+"/" |
856 | 78 | 78 | ||
857 | 79 | if options.show_version: | 79 | if options.show_version: |
859 | 80 | print("%s: version %s" % (os.path.basename(sys.argv[0]), VERSION)) | 80 | print("{0}: version {1}".format(os.path.basename(sys.argv[0]), VERSION)) |
860 | 81 | sys.exit(0) | 81 | sys.exit(0) |
861 | 82 | 82 | ||
862 | 83 | module_name = "DistUpgrade." + options.frontend | 83 | module_name = "DistUpgrade." + options.frontend |
863 | @@ -86,7 +86,7 @@ | |||
864 | 86 | view_class = getattr(submodule, options.frontend) | 86 | view_class = getattr(submodule, options.frontend) |
865 | 87 | view = view_class(data_dir) | 87 | view = view_class(data_dir) |
866 | 88 | if options.frontend == "DistUpgradeViewGtk3": | 88 | if options.frontend == "DistUpgradeViewGtk3": |
869 | 89 | view.label_title.set_markup("<b><big>%s</big></b>" % | 89 | view.label_title.set_markup("<b><big>{0}</big></b>".format( |
870 | 90 | _("Running partial upgrade")) | 90 | _("Running partial upgrade"))) |
871 | 91 | controller = DistUpgradeController(view, datadir=data_dir) | 91 | controller = DistUpgradeController(view, datadir=data_dir) |
872 | 92 | controller.doPartialUpgrade() | 92 | controller.doPartialUpgrade() |
873 | 93 | 93 | ||
874 | === modified file 'pre-build.sh' | |||
875 | --- pre-build.sh 2014-04-07 12:30:43 +0000 | |||
876 | +++ pre-build.sh 2014-04-24 08:46:39 +0000 | |||
877 | @@ -8,6 +8,11 @@ | |||
878 | 8 | dpkg-checkbuilddeps -d 'python3-apt, apt-btrfs-snapshot, parsewiki, python-feedparser, | 8 | dpkg-checkbuilddeps -d 'python3-apt, apt-btrfs-snapshot, parsewiki, python-feedparser, |
879 | 9 | python3-mock, xvfb, gir1.2-gtk-3.0, python3-gi, python3-nose' | 9 | python3-mock, xvfb, gir1.2-gtk-3.0, python3-gi, python3-nose' |
880 | 10 | 10 | ||
881 | 11 | # check the po files (LP: #1311396) | ||
882 | 12 | for po in po/*.po; do | ||
883 | 13 | msgfmt -c $po | ||
884 | 14 | done | ||
885 | 15 | |||
886 | 11 | # update demotions | 16 | # update demotions |
887 | 12 | (cd utils && ./demotions.py saucy trusty > demoted.cfg) | 17 | (cd utils && ./demotions.py saucy trusty > demoted.cfg) |
888 | 13 | # when this gets enabled, make sure to add symlink in DistUpgrade | 18 | # when this gets enabled, make sure to add symlink in DistUpgrade |
Maybe str.format is better for other reasons, but you can certainly still get tracebacks from it:
$ python3 -c "'hello {0'.format( 'world' )"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: expected '}' before end of string