From 23ac25c0b388b5ffebf66154b12a3950b89b977a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Wed, 14 Mar 2018 02:56:04 +0100 Subject: Port to Python 3 --- minidinstall/ChangeFile.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'minidinstall/ChangeFile.py') diff --git a/minidinstall/ChangeFile.py b/minidinstall/ChangeFile.py index 702069e..3b0cf48 100644 --- a/minidinstall/ChangeFile.py +++ b/minidinstall/ChangeFile.py @@ -19,7 +19,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import os, re, sys, string, stat -import threading, Queue +import threading, queue import logging from minidinstall import DpkgControl, SignedFile from minidinstall import misc @@ -28,7 +28,7 @@ class ChangeFileException(Exception): def __init__(self, value): self._value = value def __str__(self): - return `self._value` + return repr(self._value) class ChangeFile(DpkgControl.DpkgParagraph): md5_re = r'^(?P[0-9a-f]{32})[ \t]+(?P\d+)[ \t]+(?P
[-/a-zA-Z0-9]+)[ \t]+(?P[-a-zA-Z0-9]+)[ \t]+(?P[0-9a-zA-Z][-+:.,=~0-9a-zA-Z_]+)$' @@ -84,7 +84,7 @@ class ChangeFile(DpkgControl.DpkgParagraph): def verify(self, sourcedir): """ verify size and hash values from changes file """ checksum = self._get_checksum_from_changes() - for hash in checksum.keys(): + for hash in list(checksum.keys()): for (hashsum, size, filename) in checksum[hash]: self._verify_file_integrity(os.path.join(sourcedir, filename), int(size), hash, hashsum) @@ -97,7 +97,7 @@ class ChangeFile(DpkgControl.DpkgParagraph): if not stat.S_ISREG(statbuf[stat.ST_MODE]): raise ChangeFileException("%s is not a regular file" % (filename,)) size = statbuf[stat.ST_SIZE] - except OSError, e: + except OSError as e: raise ChangeFileException("Can't stat %s: %s" % (filename,e.strerror)) if size != expected_size: raise ChangeFileException("File size for %s does not match that specified in .dsc" % (filename,)) -- cgit v1.2.3