diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-07-02 07:50:54 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-07-02 07:50:54 +0000 |
commit | 2ea11722ca25a22659685e4b8020a9c52b933b6a (patch) | |
tree | 4f1f7c91cea611f01ba396ead5dd200e8915a587 /pym/portage/locks.py | |
parent | Fix EbuildBuild.execute() to return os.EX_OK on success. (diff) | |
download | portage-2ea11722ca25a22659685e4b8020a9c52b933b6a.tar.gz portage-2ea11722ca25a22659685e4b8020a9c52b933b6a.tar.bz2 portage-2ea11722ca25a22659685e4b8020a9c52b933b6a.zip |
Py3k compatibility patch by Ali Polatel <hawking@g.o>.
Don't use the format raise Exception, "string"
svn path=/main/trunk/; revision=10890
Diffstat (limited to 'pym/portage/locks.py')
-rw-r--r-- | pym/portage/locks.py | 13 |
1 files changed, 8 insertions, 5 deletions
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) |