From 2ea11722ca25a22659685e4b8020a9c52b933b6a Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 2 Jul 2008 07:50:54 +0000 Subject: Py3k compatibility patch by Ali Polatel . Don't use the format raise Exception, "string" svn path=/main/trunk/; revision=10890 --- pym/portage/locks.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'pym/portage/locks.py') diff --git a/pym/portage/locks.py b/pym/portage/locks.py index 279804475..004108eb7 100644 --- a/pym/portage/locks.py +++ b/pym/portage/locks.py @@ -23,7 +23,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, waiting_msg=None): import fcntl if not mypath: - raise InvalidData, "Empty path given" + raise InvalidData("Empty path given") if type(mypath) == types.StringType and mypath[-1] == '/': mypath = mypath[:-1] @@ -44,7 +44,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, waiting_msg=None): if type(mypath) == types.StringType: if not os.path.exists(os.path.dirname(mypath)): - raise DirectoryNotFound, os.path.dirname(mypath) + raise DirectoryNotFound(os.path.dirname(mypath)) if not os.path.exists(lockfilename): old_mask=os.umask(000) myfd = os.open(lockfilename, os.O_CREAT|os.O_RDWR,0660) @@ -65,7 +65,8 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, waiting_msg=None): myfd = mypath else: - raise ValueError, "Unknown type passed in '%s': '%s'" % (type(mypath),mypath) + raise ValueError("Unknown type passed in '%s': '%s'" % \ + (type(mypath), mypath)) # try for a non-blocking lock, if it's held, throw a message # we're waiting on lockfile and use a blocking attempt. @@ -165,7 +166,7 @@ def unlockfile(mytuple): except OSError: if type(lockfilename) == types.StringType: 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 @@ -230,7 +231,9 @@ def hardlink_lockfile(lockfilename, max_wait=14400): os.close(myfd) if not os.path.exists(myhardlock): - raise FileNotFound, _("Created lockfile is missing: %(filename)s") % {"filename":myhardlock} + raise FileNotFound( + _("Created lockfile is missing: %(filename)s") % \ + {"filename" : myhardlock}) try: res = os.link(myhardlock, lockfilename) -- cgit v1.2.3-1-g7c22