summaryrefslogtreecommitdiffstats
path: root/pym/portage/locks.py
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2009-08-15 18:13:18 +0000
committerArfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>2009-08-15 18:13:18 +0000
commit74ecc5568944b42e38cd99a4c07a6249bc9a56ed (patch)
tree4afdd58d9462b0d2efe71edfa43810e42766b5d2 /pym/portage/locks.py
parent6a454b2769795983b0f91d341632782b2596ef0b (diff)
downloadportage-74ecc5568944b42e38cd99a4c07a6249bc9a56ed.tar.gz
portage-74ecc5568944b42e38cd99a4c07a6249bc9a56ed.tar.bz2
portage-74ecc5568944b42e38cd99a4c07a6249bc9a56ed.zip
Prepare 308 messages to localization.
svn path=/main/trunk/; revision=14067
Diffstat (limited to 'pym/portage/locks.py')
-rw-r--r--pym/portage/locks.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/pym/portage/locks.py b/pym/portage/locks.py
index c256a5ada..c41b4aae7 100644
--- a/pym/portage/locks.py
+++ b/pym/portage/locks.py
@@ -35,7 +35,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
import fcntl
if not mypath:
- raise InvalidData("Empty path given")
+ raise InvalidData(_("Empty path given"))
if isinstance(mypath, basestring) and mypath[-1] == '/':
mypath = mypath[:-1]
@@ -82,8 +82,8 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
unlinkfile=unlinkfile, waiting_msg=waiting_msg,
flags=flags)
else:
- writemsg("Cannot chown a lockfile. This could " + \
- "cause inconvenience later.\n")
+ writemsg(_("Cannot chown a lockfile. This could "
+ "cause inconvenience later.\n"))
finally:
os.umask(old_mask)
@@ -92,7 +92,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
myfd = mypath
else:
- raise ValueError("Unknown type passed in '%s': '%s'" % \
+ raise ValueError(_("Unknown type passed in '%s': '%s'") % \
(type(mypath), mypath))
# try for a non-blocking lock, if it's held, throw a message
@@ -113,9 +113,9 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
out.quiet = _quiet
if waiting_msg is None:
if isinstance(mypath, int):
- waiting_msg = "waiting for lock on fd %i" % myfd
+ waiting_msg = _("waiting for lock on fd %i") % myfd
else:
- waiting_msg = "waiting for lock on %s\n" % lockfilename
+ waiting_msg = _("waiting for lock on %s\n") % lockfilename
out.ebegin(waiting_msg)
# try for the exclusive lock now.
try:
@@ -148,7 +148,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
myfd != HARDLINK_FD and _fstat_nlink(myfd) == 0:
# The file was deleted on us... Keep trying to make one...
os.close(myfd)
- writemsg("lockfile recurse\n",1)
+ writemsg(_("lockfile recurse\n"), 1)
lockfilename, myfd, unlinkfile, locking_method = lockfile(
mypath, wantnewlockfile=wantnewlockfile, unlinkfile=unlinkfile,
waiting_msg=waiting_msg, flags=flags)
@@ -191,7 +191,7 @@ def unlockfile(mytuple):
# myfd may be None here due to myfd = mypath in lockfile()
if isinstance(lockfilename, basestring) and \
not os.path.exists(lockfilename):
- writemsg("lockfile does not exist '%s'\n" % lockfilename,1)
+ writemsg(_("lockfile does not exist '%s'\n") % lockfilename,1)
if myfd is not None:
os.close(myfd)
return False
@@ -204,7 +204,7 @@ def unlockfile(mytuple):
except OSError:
if isinstance(lockfilename, basestring):
os.close(myfd)
- raise IOError("Failed to unlock file '%s'\n" % lockfilename)
+ raise IOError(_("Failed to unlock file '%s'\n") % lockfilename)
try:
# This sleep call was added to allow other processes that are
@@ -217,17 +217,17 @@ def unlockfile(mytuple):
locking_method(myfd,fcntl.LOCK_EX|fcntl.LOCK_NB)
# We won the lock, so there isn't competition for it.
# We can safely delete the file.
- writemsg("Got the lockfile...\n",1)
+ writemsg(_("Got the lockfile...\n"), 1)
if _fstat_nlink(myfd) == 1:
os.unlink(lockfilename)
- writemsg("Unlinked lockfile...\n",1)
+ writemsg(_("Unlinked lockfile...\n"), 1)
locking_method(myfd,fcntl.LOCK_UN)
else:
- writemsg("lockfile does not exist '%s'\n" % lockfilename,1)
+ writemsg(_("lockfile does not exist '%s'\n") % lockfilename, 1)
os.close(myfd)
return False
except Exception, e:
- writemsg("Failed to get lock... someone took it.\n",1)
+ writemsg(_("Failed to get lock... someone took it.\n"), 1)
writemsg(str(e)+"\n",1)
# why test lockfilename? because we may have been handed an
@@ -289,10 +289,10 @@ def hardlink_lockfile(lockfilename, max_wait=14400):
else:
reported_waiting = True
from portage.const import PORTAGE_BIN_PATH
- msg = "\nWaiting on (hardlink) lockfile:" + \
- " (one '.' per 3 seconds)\n" + \
- "%s/clean_locks can fix stuck locks.\n" % PORTAGE_BIN_PATH + \
- "Lockfile: %s\n" % lockfilename
+ msg = _("\nWaiting on (hardlink) lockfile: (one '.' per 3 seconds)\n"
+ "%(bin_path)s/clean_locks can fix stuck locks.\n"
+ "Lockfile: %(lockfilename)s\n") % \
+ {"bin_path": PORTAGE_BIN_PATH, "lockfilename": lockfilename}
writemsg(msg, noiselevel=-1)
time.sleep(3)
@@ -339,7 +339,7 @@ def hardlock_cleanup(path, remove_all_locks=False):
mycount += 1
- results.append("Found %(count)s locks" % {"count":mycount})
+ results.append(_("Found %(count)s locks") % {"count":mycount})
for x in mylist:
if myhost in mylist[x] or remove_all_locks: