From: Zac Medico Date: Thu, 27 Sep 2007 22:26:42 +0000 (-0000) Subject: Move prelink tempfile cleanup to the finally block and X-Git-Tag: v2.2_pre1~762 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=77a93135b0c763e53ef0d611d3a453a905083ff5;p=portage.git Move prelink tempfile cleanup to the finally block and remove unused locking code. svn path=/main/trunk/; revision=7864 --- diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py index c663b68d9..77716aefc 100644 --- a/pym/portage/checksum.py +++ b/pym/portage/checksum.py @@ -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): """