Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit 894f3346fd00dee77daf0395868e817e1b772b7c
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Feb 11 16:21:48 2014 +0100
fix compilation problems
---------------------------------------------------------------
dnf-plugin/copr_hook.py | 39 ++++++++++++++++++++++-----------------
1 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/dnf-plugin/copr_hook.py b/dnf-plugin/copr_hook.py
index 7c86d79..b4e4260 100644
--- a/dnf-plugin/copr_hook.py
+++ b/dnf-plugin/copr_hook.py
@@ -1,10 +1,12 @@
import dnf
+import os
import sys
+from dnf.yum.i18n import _
from urlgrabber import grabber
-yes = set(['yes','y', ''])
-no = set(['no','n'])
+yes = set([_('yes'), _('y'), ''])
+no = set([_('no'), _('n')])
class Copr(dnf.Plugin):
"""DNF plugin supplying the 'copr' command."""
@@ -19,16 +21,17 @@ class Copr(dnf.Plugin):
class CoprCommand(dnf.cli.Command):
""" Copr plugin for DNF """
- aliases = "copr"
- def run(self.args):
+ aliases = ("copr")
+
+ def run(self, extcmds):
# FIXME this should do dnf itself (BZ#1062889)
if os.geteuid() != 0:
- raise dnf.exceptions.Error('This command has to be run under the root
user.')
+ raise dnf.exceptions.Error(_('This command has to be run under the root
user.'))
try:
subcommand, project_name, chroot = extcmds
except ValueError:
- raise ValueError('exactly three additional parameters to copr command are
required')
+ raise ValueError(_('exactly three additional parameters to copr command
are required'))
repo_filename =
"/etc/yum.repos.d/{}.repo".format(project_name.replace("/",
"_"))
if subcommand == "enable":
@@ -40,25 +43,27 @@ class CoprCommand(dnf.cli.Command):
ug = grabber.URLGrabber()
# FIXME when we are full on python2 urllib.parse
try:
- fn = ug.urlgrab(base_url+api_path, filename=repo_filename)
+ ug.urlgrab(base_url+api_path, filename=repo_filename)
except grabber.URLGrabError, e:
raise dnf.exceptions.Error(str(e)), None, sys.exc_info()[2]
self.base.read_all_repos()
else:
raise dnf.exceptions.Error(_('Unknown subcommand
{}.').format(subcommand))
- def _ask_user(self):
- question = """
+ @classmethod
+ def _ask_user(cls):
+ question = _("""
You are going to enable Copr repository. Please not that this repository is not
part of Fedora and may have various quality and Fedora distribution have no
power over this repository and can not enforce some quality or security level.
Please do not file bug reports about this packages in Fedora bugzilla.
In case of problems you should contact owner of this repository.
-Do you want to continue? [Y/n]: """
- answer = raw_input(question).lower()
- while not ((answer in yes) or (answer in no)):
- answer = raw_input(question).lower()
- if answer in yes:
- return
- else:
- raise dnf.exceptions.Error('Safe and good answer. Exiting.')
+Do you want to continue? [Y/n]: """)
+ answer = raw_input(question).lower()
+ answer = _(answer)
+ while not ((answer in yes) or (answer in no)):
+ answer = raw_input(question).lower()
+ if answer in yes:
+ return
+ else:
+ raise dnf.exceptions.Error(_('Safe and good answer. Exiting.'))