Move prelink tempfile cleanup to the finally block and
authorZac Medico <zmedico@gentoo.org>
Thu, 27 Sep 2007 22:26:42 +0000 (22:26 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 27 Sep 2007 22:26:42 +0000 (22:26 -0000)
remove unused locking code.

svn path=/main/trunk/; revision=7864

pym/portage/checksum.py

index c663b68d9987664601b7f302afe9b27a86569859..77716aefc44623c697508f63ab378f79bc441f85 100644 (file)
@@ -10,7 +10,6 @@ import stat
 import tempfile
 import portage.exception
 import portage.process
-import portage.locks
 import commands
 import md5, sha
 
@@ -200,7 +199,6 @@ def perform_checksum(filename, hashname="MD5", calc_prelink=0):
        global prelink_capable
        myfilename      = filename[:]
        prelink_tmpfile = None
-       mylock          = None
        try:
                if calc_prelink and prelink_capable:
                        # Create non-prelinked temporary file to checksum.
@@ -226,6 +224,8 @@ def perform_checksum(filename, hashname="MD5", calc_prelink=0):
                        if e.errno == errno.ENOENT:
                                raise portage.exception.FileNotFound(myfilename)
                        raise
+               return myhash, mysize
+       finally:
                if prelink_tmpfile:
                        try:
                                os.unlink(prelink_tmpfile)
@@ -233,10 +233,6 @@ def perform_checksum(filename, hashname="MD5", calc_prelink=0):
                                if e.errno != errno.ENOENT:
                                        raise
                                del e
-               return myhash, mysize
-       finally:
-               if mylock:
-                       portage.locks.unlockfile(mylock)
 
 def perform_multiple_checksums(filename, hashes=["MD5"], calc_prelink=0):
        """