Sync translate

master3.3
Mike khiretskiy 10 years ago
parent af5ce6c595
commit e78cc81fda

@ -447,7 +447,7 @@ class EmergeingErrorBlock(EmergeInformationBlock):
return self.text_converter.transform(readFile(self.result)) return self.text_converter.transform(readFile(self.result))
def action(self, child): def action(self, child):
raise EmergeError(_("Emerge %s is failed") % self.package) raise EmergeError(_("Failed to emerge %s") % self.package)
class RevdepPercentBlock(NotifierInformationBlock): class RevdepPercentBlock(NotifierInformationBlock):

@ -140,11 +140,11 @@ class Git:
if path.exists(rpath): if path.exists(rpath):
if not path.isdir(rpath): if not path.isdir(rpath):
raise GitError( raise GitError(
_("Repository {path} is not directory").format( _("Repository {path} is not a directory").format(
path=rpath)) path=rpath))
if not path.isdir(self._gitDir(rpath)): if not path.isdir(self._gitDir(rpath)):
raise GitError( raise GitError(
_("Repository {path} is not git").format( _("Repository {path} is not Git").format(
path=rpath)) path=rpath))
return True return True
return False return False
@ -155,7 +155,7 @@ class Git:
""" """
git = getProgPath("/usr/bin/git") git = getProgPath("/usr/bin/git")
if not git: if not git:
raise GitError(_("Git utility is not found")) raise GitError(_("The Git tool is not found"))
return git return git
@staticmethod @staticmethod
@ -191,9 +191,9 @@ class Git:
error = gitClone.read() error = gitClone.read()
if "Remote branch %s not found" % branch in error: if "Remote branch %s not found" % branch in error:
raise GitError( raise GitError(
_("Branch {branch} not found in {url} repository").format( _("Branch {branch} not found in repository {url}").format(
branch=branch, url=url)) branch=branch, url=url))
raise GitError(_("Failed to clone {url} repository").format( raise GitError(_("Failed to clone repository {url}").format(
url=url), error) url=url), error)
return True return True
@ -272,7 +272,7 @@ class Git:
if command("get_rev_tag") or command("fetchshallow"): if command("get_rev_tag") or command("fetchshallow"):
if not command("has_branch"): if not command("has_branch"):
raise GitError( raise GitError(
_("Branch {branch} not found in {url} repository" _("Branch {branch} not found in repository {url}"
).format(branch=branch, url=url)) ).format(branch=branch, url=url))
# если среди коммитов есть указанный коммит # если среди коммитов есть указанный коммит
if command("has_revision"): if command("has_revision"):
@ -281,7 +281,7 @@ class Git:
return True return True
elif command("checkout"): elif command("checkout"):
return False return False
raise GitError(_("Failed to clone {url} repository").format( raise GitError(_("Failed to clone repository {url}").format(
url=url), error[-1]) url=url), error[-1])
def pullRepository(self, rpath, quiet_error=False, cb_progress=None): def pullRepository(self, rpath, quiet_error=False, cb_progress=None):
@ -294,7 +294,7 @@ class Git:
if not quiet_error: if not quiet_error:
error = gitPull.read() error = gitPull.read()
raise GitError( raise GitError(
_("Failed to update repository in {rpath}").format( _("Failed to update the repository in {rpath}").format(
rpath=rpath), error) rpath=rpath), error)
return False return False
return True return True
@ -316,7 +316,7 @@ class Git:
if gitFetch.failed(): if gitFetch.failed():
error = gitFetch.read() error = gitFetch.read()
raise GitError( raise GitError(
_("Failed to update repository in {rpath}").format( _("Failed to update the repository in {rpath}").format(
rpath=rpath), error) rpath=rpath), error)
return True return True
@ -332,7 +332,7 @@ class Git:
return not any(x.strip() for x in git_status) return not any(x.strip() for x in git_status)
else: else:
raise GitError( raise GitError(
_("Wrong repository in {rpath} directory").format( _("Wrong repository in the {rpath} directory").format(
rpath=rpath)) rpath=rpath))
def parseStatusInfo(self, data): def parseStatusInfo(self, data):
@ -376,8 +376,7 @@ class Git:
return git_show.read().strip() return git_show.read().strip()
else: else:
raise GitError( raise GitError(
_("Failed to get status of repository in " _("Failed to get the repository status for {rpath}").format(
"{rpath} directory").format(
rpath=rpath)) rpath=rpath))
def getStatusInfo(self, rpath): def getStatusInfo(self, rpath):
@ -395,13 +394,12 @@ class Git:
retDict = self.parseStatusInfo(git_status.read()) retDict = self.parseStatusInfo(git_status.read())
if not retDict: if not retDict:
raise GitError( raise GitError(
_("Failed to get status of repository in " _("Failed to get the repository status for {rpath}").format(
"{rpath} directory").format(
rpath=rpath)) rpath=rpath))
return retDict return retDict
else: else:
raise GitError( raise GitError(
_("Wrong repository in {rpath} directory").format( _("Wrong repository in the {rpath} directory").format(
rpath=rpath)) rpath=rpath))
def resetRepository(self, rpath, to_origin=False, to_rev=None, info=None): def resetRepository(self, rpath, to_origin=False, to_rev=None, info=None):
@ -434,7 +432,7 @@ class Git:
rpath, rpath,
"clean", "-fd", stderr=STDOUT) "clean", "-fd", stderr=STDOUT)
if git_reset.failed() or git_clean.failed(): if git_reset.failed() or git_clean.failed():
raise GitError(_("Failed to clean {rpath} repository").format( raise GitError(_("Failed to clean the {rpath} repository").format(
rpath=rpath)) rpath=rpath))
return True return True
@ -456,11 +454,11 @@ class Git:
error = git_checkout.read() error = git_checkout.read()
if "pathspec '%s' did not match" % branch in error: if "pathspec '%s' did not match" % branch in error:
raise GitError( raise GitError(
_("Branch {branch} not found in {rpath} repository").format( _("Branch {branch} not found in repository {rpath}").format(
branch=branch, rpath=rpath)) branch=branch, rpath=rpath))
raise GitError( raise GitError(
_("Failed to change branch to {branch} in " _("Failed to change branch to {branch} in the {rpath} "
"{rpath} repository").format(branch=branch, "repository").format(branch=branch,
rpath=rpath), error) rpath=rpath), error)
return True return True

@ -116,7 +116,7 @@ class Update:
raise UpdateError(_("Update is already running. " raise UpdateError(_("Update is already running. "
"Try to run later.")) "Try to run later."))
else: else:
self.startTask(_("Waiting for complete another update")) self.startTask(_("Waiting for another update to be complete"))
while any(ifilter(lambda x: os.getpid() != x, while any(ifilter(lambda x: os.getpid() != x,
search_worked_process('update', dv))): search_worked_process('update', dv))):
time.sleep(0.3) time.sleep(0.3)
@ -133,8 +133,8 @@ class Update:
"cl_update_rep_rev", "cl_update_branch_name"], "cl_update_rep_rev", "cl_update_branch_name"],
where="cl_update_rep_name", eq=repname, limit=1)) where="cl_update_rep_name", eq=repname, limit=1))
if not url or not rpath: if not url or not rpath:
raise UpdateError(_("Variables with repositories settings " raise UpdateError(_("Configuration variables for repositories "
"is not configured")) "are not setup"))
self.addProgress() self.addProgress()
if clean_on_error: if clean_on_error:
try: try:
@ -148,7 +148,7 @@ class Update:
self.printWARNING(str(e)) self.printWARNING(str(e))
self.endTask(False) self.endTask(False)
self.startTask( self.startTask(
_("Re-fetch {name} repository").format(name=repname)) _("Re-fetching the {name} repository").format(name=repname))
self.addProgress() self.addProgress()
try: try:
rpath_new = "%s_new" % rpath rpath_new = "%s_new" % rpath
@ -157,7 +157,7 @@ class Update:
removeDir(rpath) removeDir(rpath)
os.rename(rpath_new, rpath) os.rename(rpath_new, rpath)
except OSError: except OSError:
raise UpdateError(_("Permission denied to change " raise UpdateError(_("Permission denied to modify the "
"{repname} repository").format( "{repname} repository").format(
repname=repname)) repname=repname))
finally: finally:
@ -179,7 +179,7 @@ class Update:
""" """
layman = getProgPath('/usr/bin/layman') layman = getProgPath('/usr/bin/layman')
if not layman: if not layman:
raise UpdateError(_("Layman utility is not found")) raise UpdateError(_("The Layman tool is not found"))
rpath = self.clVars.Select('cl_update_other_rep_path', rpath = self.clVars.Select('cl_update_other_rep_path',
where='cl_update_other_rep_name', eq=repname, where='cl_update_other_rep_name', eq=repname,
limit=1) limit=1)
@ -193,7 +193,7 @@ class Update:
p = process(layman, "-s", repname, stderr=STDOUT) p = process(layman, "-s", repname, stderr=STDOUT)
if p.failed(): if p.failed():
raise UpdateError( raise UpdateError(
_("Failed to update repository {rname}").format(rname=repname), _("Failed to update the {rname} repository").format(rname=repname),
addon=p.read()) addon=p.read())
return True return True
@ -203,12 +203,12 @@ class Update:
""" """
egenCache = getProgPath('/usr/bin/egencache') egenCache = getProgPath('/usr/bin/egencache')
if not egenCache: if not egenCache:
raise UpdateError(_("Portage utility is not found")) raise UpdateError(_("The Portage tool is not found"))
cpu_num = self.clVars.Get('hr_cpu_num') cpu_num = self.clVars.Get('hr_cpu_num')
p = process(egenCache, "--repo=%s" % repname, "--update", p = process(egenCache, "--repo=%s" % repname, "--update",
"--jobs=%s" % cpu_num, stderr=STDOUT) "--jobs=%s" % cpu_num, stderr=STDOUT)
if p.failed(): if p.failed():
raise UpdateError(_("Failed to update cache of {rname} " raise UpdateError(_("Failed to update the cache of the {rname} "
"repository").format(rname=repname), "repository").format(rname=repname),
addon=p.read()) addon=p.read())
return True return True
@ -219,7 +219,7 @@ class Update:
""" """
emerge = getProgPath("/usr/bin/emerge") emerge = getProgPath("/usr/bin/emerge")
if not emerge: if not emerge:
raise UpdateError(_("Emerge utility is not found")) raise UpdateError(_("The Emerge tool is not found"))
self.addProgress() self.addProgress()
p = PercentProgress(emerge, "--metadata", part=1, atty=True) p = PercentProgress(emerge, "--metadata", part=1, atty=True)
for perc in p.progress(): for perc in p.progress():
@ -238,7 +238,7 @@ class Update:
""" """
eixupdate = getProgPath("/usr/bin/eix-update") eixupdate = getProgPath("/usr/bin/eix-update")
if not eixupdate: if not eixupdate:
raise UpdateError(_("Eix utility is not found")) raise UpdateError(_("The Eix tool is not found"))
self.addProgress() self.addProgress()
excludeList = [] excludeList = []
if self.clVars.Get('cl_update_eixupdate_force') == 'force': if self.clVars.Get('cl_update_eixupdate_force') == 'force':
@ -337,7 +337,7 @@ class Update:
""" """
cmd_path = getProgPath(cmd) cmd_path = getProgPath(cmd)
if not cmd_path: if not cmd_path:
raise UpdateError(_("Failed to find %s command") % cmd) raise UpdateError(_("Failed to find the %s command") % cmd)
with EmergeParser( with EmergeParser(
emerge_parser.CommandExecutor(cmd_path, params)) as emerge: emerge_parser.CommandExecutor(cmd_path, params)) as emerge:
self._startEmerging(emerge) self._startEmerging(emerge)
@ -349,7 +349,7 @@ class Update:
""" """
cmd_path = getProgPath(cmd) cmd_path = getProgPath(cmd)
if not cmd_path: if not cmd_path:
raise UpdateError(_("Failed to find %s command") % cmd) raise UpdateError(_("Failed to find the %s command") % cmd)
with EmergeParser( with EmergeParser(
emerge_parser.CommandExecutor(cmd_path, params)) as emerge: emerge_parser.CommandExecutor(cmd_path, params)) as emerge:
revdep = RevdepPercentBlock(emerge) revdep = RevdepPercentBlock(emerge)
@ -409,7 +409,7 @@ class Update:
self._display_pretty_package_list(pkglist) self._display_pretty_package_list(pkglist)
if emerge.install_packages.remove_list: if emerge.install_packages.remove_list:
self.printSUCCESS(_print( self.printSUCCESS(_print(
_("List removal packages"))) _("Listing packages for removal")))
self._display_pretty_package_list( self._display_pretty_package_list(
emerge.install_packages.remove_list, remove_list=True) emerge.install_packages.remove_list, remove_list=True)
if str(emerge.download_size) != "0 kB": if str(emerge.download_size) != "0 kB":
@ -427,7 +427,7 @@ class Update:
_print = self.color_print _print = self.color_print
pkglist = emerge.uninstall_packages.list pkglist = emerge.uninstall_packages.list
self.printSUCCESS(_print.bold( self.printSUCCESS(_print.bold(
_("List removal packages"))) _("Listing packages for removal")))
self._display_pretty_package_list(pkglist, remove_list=True) self._display_pretty_package_list(pkglist, remove_list=True)
def getCacheOnWorld(self, params, packages, check=False): def getCacheOnWorld(self, params, packages, check=False):

@ -151,7 +151,7 @@ class ClUpdateAction(Action):
] ]
}, },
{'name': 'update_other:depclean', {'name': 'update_other:depclean',
'group': __("Cleaning system from needless packages"), 'group': __("Cleaning the system from needless packages"),
'tasks': [ 'tasks': [
{'name': 'update_other:update_depclean', {'name': 'update_other:update_depclean',
'message': __("Calculating dependencies"), 'message': __("Calculating dependencies"),
@ -236,7 +236,7 @@ class ClUpdateAction(Action):
'essential': False, 'essential': False,
}, },
{'name': 'emerge_metadata', {'name': 'emerge_metadata',
'message': __("Metadata trasfer"), 'message': __("Metadata transfer"),
'method': 'Update.emergeMetadata()', 'method': 'Update.emergeMetadata()',
'condition': ( 'condition': (
lambda Get: (Get('cl_update_outdate_set') == 'on' and lambda Get: (Get('cl_update_outdate_set') == 'on' and
@ -244,7 +244,7 @@ class ClUpdateAction(Action):
Get('cl_update_metadata_force') == 'force')) Get('cl_update_metadata_force') == 'force'))
}, },
{'name': 'eix_update', {'name': 'eix_update',
'message': __("Updating eix cache"), 'message': __("Updating the eix cache"),
'method': 'Update.eixUpdate()', 'method': 'Update.eixUpdate()',
'condition': ( 'condition': (
lambda Get: (Get('cl_update_outdate_set') == 'on' and lambda Get: (Get('cl_update_outdate_set') == 'on' and

@ -74,8 +74,8 @@ class VariableClUpdateRevSet(Variable):
"cl_update_eixupdate_force"] "cl_update_eixupdate_force"]
def init(self): def init(self):
self.help = _("revision update") self.help = _("make a revision update")
self.label = _("Revision update") self.label = _("Make a revision update")
class VariableClUpdateRep(Variable): class VariableClUpdateRep(Variable):
""" """
@ -122,7 +122,7 @@ class VariableClUpdateSystemProfile(ReadonlyVariable):
path.join(path.dirname(make_profile), path.join(path.dirname(make_profile),
os.readlink(make_profile))) os.readlink(make_profile)))
except: except:
raise VariableError(_("Failed to determine system profile")) raise VariableError(_("Failed to determine the system profile"))
class VariableClUpdateLaymanStorage(ReadonlyVariable): class VariableClUpdateLaymanStorage(ReadonlyVariable):
""" """
@ -239,8 +239,8 @@ class VariableClUpdateSyncRep(Variable):
untrusted = True untrusted = True
def init(self): def init(self):
self.help = _("synchronize repositories (all by default)") self.help = _("synchronized repositories (all by default)")
self.label = _("Synchronize repositories") self.label = _("Synchronized repositories")
def set(self,value): def set(self,value):
orderList = self.Get('cl_update_rep_name') orderList = self.Get('cl_update_rep_name')
@ -288,15 +288,15 @@ class VariableClUpdateMetadataForce(Variable):
#untrusted = True #untrusted = True
def init(self): def init(self):
self.help = ("'force' - " + _("force update ebuilds metadata") + self.help = ("'force' - " + _("force the update ebuilds metadata") +
",\n'skip' - " + _("skip update ebuilds metadata") + ",\n'skip' - " + _("skip the ebuild metadata update") +
",\n'auto' - " + _("update metadata if they are outdated")) ",\n'auto' - " + _("update metadata if it is outdated"))
self.label = _("Update metadata") self.label = _("Update metadata")
def choice(self): def choice(self):
return [("force", _("Force")), return [("force", _("Force")),
("skip", _("Skip")), ("skip", _("Skip")),
("auto", _("By need"))] ("auto", _("If needed"))]
class VariableClUpdateEixupdateForce(Variable): class VariableClUpdateEixupdateForce(Variable):
""" """
@ -310,15 +310,16 @@ class VariableClUpdateEixupdateForce(Variable):
#untrusted = True #untrusted = True
def init(self): def init(self):
self.help = ("'force' - " + _("force update eix cache") + self.help = ("'force' - " + _("force the eix cache update") +
",\n'skip' - " + _("skip update eix cache") + ",\n'skip' - " + _("skip the eix cache update") +
",\n'auto' - " + _("update eix cache if it is outdated")) ",\n'auto' - " + _("update the eix cache if it "
self.label = _("Update eix cache") "is outdated"))
self.label = _("Update the eix cache")
def choice(self): def choice(self):
return [("force", _("Force")), return [("force", _("Force")),
("skip", _("Skip")), ("skip", _("Skip")),
("auto", _("By need"))] ("auto", _("If needed"))]
class VariableClUpdateOtherSet(Variable): class VariableClUpdateOtherSet(Variable):
""" """
@ -389,9 +390,10 @@ class VariableClUpdatePretendSet(Variable):
opt = ["-p", "--pretend"] opt = ["-p", "--pretend"]
def init(self): def init(self):
self.label = _("Pretend package update") self.label = _("Pretend a package update")
self.help = _("instead of actually performing packages update, " self.help = _("instead of actually performing the update, "
"simply only display what have been installed") "simply display the list of packages that "
"will be installed")
class VariableClUpdateSyncOnlySet(Variable): class VariableClUpdateSyncOnlySet(Variable):
""" """
@ -423,5 +425,5 @@ class VariableClUpdateWaitAnotherSet(Variable):
opt = ["--wait-another-update"] opt = ["--wait-another-update"]
def init(self): def init(self):
self.label = _("Wait for complete another update") self.label = _("Wait for another update to be complete")
self.help = _("wait until the other updates or abort") self.help = _("wait until the running update is finished")

@ -39,7 +39,7 @@ class Wsdl(WsdlBase):
# категория метода # категория метода
'category': __('Update'), 'category': __('Update'),
# заголовок метода # заголовок метода
'title': __("Update System"), 'title': __("Update the System"),
# иконка для графической консоли # иконка для графической консоли
'image': 'software-properties,preferences-desktop', 'image': 'software-properties,preferences-desktop',
# метод присутствует в графической консоли # метод присутствует в графической консоли
@ -60,7 +60,7 @@ class Wsdl(WsdlBase):
'setvars': {'cl_action!': 'sync'}, 'setvars': {'cl_action!': 'sync'},
# описание груп (список лямбда функций) # описание груп (список лямбда функций)
'groups': [ 'groups': [
lambda group: group(_("Update system"), lambda group: group(_("Update the system"),
normal=(), normal=(),
expert=( expert=(
'cl_rebuild_world_set', 'cl_update_rev_set', 'cl_rebuild_world_set', 'cl_update_rev_set',

Loading…
Cancel
Save