diff options
| author | 2008-09-20 10:52:41 +0200 | |
|---|---|---|
| committer | 2008-09-20 18:10:30 +0200 | |
| commit | a4cc92989da6619456a69f8d176e0986c4935496 (patch) | |
| tree | 5dfbee6a2297f83bf43443e73f10f3523ab55a96 /minidinstall | |
| parent | 5bbaa283c704fb3a1d83c281031d6131cfc58a91 (diff) | |
expand tabs and remove tailing whitespaces
Diffstat (limited to 'minidinstall')
| -rw-r--r-- | minidinstall/ChangeFile.py | 10 | ||||
| -rw-r--r-- | minidinstall/Dnotify.py | 6 | ||||
| -rwxr-xr-x | minidinstall/DpkgControl.py | 6 | ||||
| -rw-r--r-- | minidinstall/GPGSigVerifier.py | 2 | ||||
| -rwxr-xr-x | minidinstall/SignedFile.py | 4 | ||||
| -rw-r--r-- | minidinstall/misc.py | 26 |
6 files changed, 27 insertions, 27 deletions
diff --git a/minidinstall/ChangeFile.py b/minidinstall/ChangeFile.py index 3b89b34..ca88112 100644 --- a/minidinstall/ChangeFile.py +++ b/minidinstall/ChangeFile.py @@ -29,16 +29,16 @@ class ChangeFileException(Exception): self._value = value def __str__(self): return `self._value` - + class ChangeFile(DpkgControl.DpkgParagraph): md5_re = r'^(?P<md5>[0-9a-f]{32})[ \t]+(?P<size>\d+)[ \t]+(?P<section>[-/a-zA-Z0-9]+)[ \t]+(?P<priority>[-a-zA-Z0-9]+)[ \t]+(?P<file>[0-9a-zA-Z][-+:.,=~0-9a-zA-Z_]+)$' sha1_re = r'^(?P<sha1>[0-9a-f]{40})[ \t]+(?P<size>\d+)[ \t]+(?P<file>[0-9a-zA-Z][-+:.,=~0-9a-zA-Z_]+)$' sha256_re = r'^(?P<sha256>[0-9a-f]{64})[ \t]+(?P<size>\d+)[ \t]+(?P<file>[0-9a-zA-Z][-+:.,=~0-9a-zA-Z_]+)$' - def __init__(self): + def __init__(self): DpkgControl.DpkgParagraph.__init__(self) self._logger = logging.getLogger("mini-dinstall") - + def load_from_file(self, filename): f = SignedFile.SignedFile(open(filename)) self.load(f) @@ -78,7 +78,7 @@ class ChangeFile(DpkgControl.DpkgParagraph): raise ChangeFileException("Couldn't parse file entry \"%s\" in Files field of .changes" % (line,)) output[hash].append([match.group(hash), match.group('size'), match.group('file') ]) return output - + def verify(self, sourcedir): """ verify size and hash values from changes file """ checksum = self._get_checksum_from_changes() @@ -86,7 +86,7 @@ class ChangeFile(DpkgControl.DpkgParagraph): for (hashsum, size, filename) in checksum[hash]: self._verify_file_integrity(os.path.join(sourcedir, filename), int(size), hash, hashsum) - + def _verify_file_integrity(self, filename, expected_size, hash, expected_hashsum): """ check uploaded file integrity """ self._logger.debug('Checking integrity of %s' % (filename,)) diff --git a/minidinstall/Dnotify.py b/minidinstall/Dnotify.py index 122e03c..e31080c 100644 --- a/minidinstall/Dnotify.py +++ b/minidinstall/Dnotify.py @@ -92,7 +92,7 @@ class MtimeDirectoryNotifier(DirectoryNotifier): self._polltime = poll_time for dir in dirs: self._dirmap[dir] = os.stat(os.path.join(self._cwd, dir))[stat.ST_MTIME] - + def poll(self, timeout=None): timeout_time = None if timeout: @@ -123,7 +123,7 @@ class DnotifyDirectoryNotifier(DirectoryNotifier): self._queue = Queue.Queue() dnotify = DnotifyThread(self._queue, self._dirs, self._logger) dnotify.start() - + def poll(self, timeout=None): # delete duplicates i = self._queue.qsize() @@ -164,7 +164,7 @@ class DnotifyThread(threading.Thread): self._queue = queue self._dirs = dirs self._logger = logger - + def run(self): self._logger.debug('Starting dnotify reading thread') (infd, outfd) = os.pipe() diff --git a/minidinstall/DpkgControl.py b/minidinstall/DpkgControl.py index 38147c7..4bda8c5 100755 --- a/minidinstall/DpkgControl.py +++ b/minidinstall/DpkgControl.py @@ -50,7 +50,7 @@ class DpkgParagraph(DpkgOrderedDatalist): value = None while 1: line = f.readline() - if not line: + if not line: return # skip blank lines until we reach a paragraph if line == '\n': @@ -124,10 +124,10 @@ class DpkgSourceControl( DpkgControl ): f = SignedFile(f) self.source = self._load_one( f ) DpkgControl.load( self, f ) - + def __repr__( self ): return self.source.__repr__() + "\n" + DpkgControl.__repr__( self ) - + def _store( self, f ): "Write our control data to a file object" self.source._store( f ) diff --git a/minidinstall/GPGSigVerifier.py b/minidinstall/GPGSigVerifier.py index 78aeebb..a8fb46c 100644 --- a/minidinstall/GPGSigVerifier.py +++ b/minidinstall/GPGSigVerifier.py @@ -74,5 +74,5 @@ class GPGSigVerifier: msg = "gpgv died with signal %d" % (os.WTERMSIG(status),) raise GPGSigVerificationFailure(msg, output) return output - + # vim:ts=4:sw=4:et: diff --git a/minidinstall/SignedFile.py b/minidinstall/SignedFile.py index 648186e..71181c3 100755 --- a/minidinstall/SignedFile.py +++ b/minidinstall/SignedFile.py @@ -63,7 +63,7 @@ class SignedFile: self._signature = string.join return '' return line - + def readlines(self): ret = [] while 1: @@ -85,7 +85,7 @@ class SignedFile: def getSignatureVersion(self): return self._signatureversion - + if __name__=="__main__": import sys if len(sys.argv) == 0: diff --git a/minidinstall/misc.py b/minidinstall/misc.py index a942adc..aeb1490 100644 --- a/minidinstall/misc.py +++ b/minidinstall/misc.py @@ -21,19 +21,19 @@ import os, errno, time, string, re, popen2 def dup2(fd,fd2): - # dup2 with EBUSY retries (cf. dup2(2) and Debian bug #265513) - success = 0 - tries = 0 - while (not success): - try: - os.dup2(fd,fd2) - success = 1 - except OSError, e: - if (e.errno != errno.EBUSY) or (tries >= 3): - raise - # wait 0-2 seconds befor next try - time.sleep(tries) - tries += 1 + # dup2 with EBUSY retries (cf. dup2(2) and Debian bug #265513) + success = 0 + tries = 0 + while (not success): + try: + os.dup2(fd,fd2) + success = 1 + except OSError, e: + if (e.errno != errno.EBUSY) or (tries >= 3): + raise + # wait 0-2 seconds befor next try + time.sleep(tries) + tries += 1 def format_changes(L): """ remove changelog header and all lines with only a dot """ |
