From 7cb8fb941f09d1ac646be334745f90e16ebd46eb Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Sun, 20 Sep 2009 10:57:44 +0000 Subject: Update syntax of 'except' statements for compatibility with Python 3. (2to3-3.1 -f except -nw ${FILES}) svn path=/main/trunk/; revision=14289 --- pym/portage/locks.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'pym/portage/locks.py') diff --git a/pym/portage/locks.py b/pym/portage/locks.py index adf82af81..f2147c5e1 100644 --- a/pym/portage/locks.py +++ b/pym/portage/locks.py @@ -65,7 +65,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, try: try: myfd = os.open(lockfilename, os.O_CREAT|os.O_RDWR, 0660) - except OSError, e: + except OSError as e: func_call = "open('%s')" % lockfilename if e.errno == OperationNotPermitted.errno: raise OperationNotPermitted(func_call) @@ -78,7 +78,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, try: if os.stat(lockfilename).st_gid != portage_gid: os.chown(lockfilename, -1, portage_gid) - except OSError, e: + except OSError as e: if e.errno in (errno.ENOENT, errno.ESTALE): return lockfile(mypath, wantnewlockfile=wantnewlockfile, @@ -103,7 +103,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, locking_method = fcntl.lockf try: fcntl.lockf(myfd,fcntl.LOCK_EX|fcntl.LOCK_NB) - except IOError, e: + except IOError as e: if "errno" not in dir(e): raise if e.errno in (errno.EACCES, errno.EAGAIN): @@ -123,7 +123,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, # try for the exclusive lock now. try: fcntl.lockf(myfd, fcntl.LOCK_EX) - except EnvironmentError, e: + except EnvironmentError as e: out.eend(1, str(e)) raise out.eend(os.EX_OK) @@ -168,7 +168,7 @@ def _fstat_nlink(fd): """ try: return os.fstat(fd).st_nlink - except EnvironmentError, e: + except EnvironmentError as e: if e.errno in (errno.ENOENT, errno.ESTALE): # Some filesystems such as CIFS return # ENOENT which means st_nlink == 0. @@ -229,7 +229,7 @@ def unlockfile(mytuple): writemsg(_("lockfile does not exist '%s'\n") % lockfilename, 1) os.close(myfd) return False - except Exception, e: + except Exception as e: writemsg(_("Failed to get lock... someone took it.\n"), 1) writemsg(str(e)+"\n",1) -- cgit v1.2.3-1-g7c22