diff options
Diffstat (limited to 'test/pacman/pmfile.py')
-rwxr-xr-x | test/pacman/pmfile.py | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/test/pacman/pmfile.py b/test/pacman/pmfile.py index ab4aa2c7..bd03a24e 100755 --- a/test/pacman/pmfile.py +++ b/test/pacman/pmfile.py @@ -18,20 +18,19 @@ import os -from util import * +import util - -class pmfile: +class pmfile(object): """File object """ def __init__(self, root, name): self.name = name self.root = root + self.filename = os.path.join(self.root, self.name) - filename = os.path.join(self.root, self.name) - self.checksum = getmd5sum(filename) - self.mtime = getmtime(filename) + self.checksum = util.getmd5sum(self.filename) + self.mtime = util.getmtime(self.filename) def __str__(self): return "%s (%s / %lu)" % (self.name, self.checksum, self.mtime) @@ -39,33 +38,17 @@ class pmfile: def ismodified(self): """ """ + checksum = util.getmd5sum(self.filename) + mtime = util.getmtime(self.filename) - retval = 0 - - filename = os.path.join(self.root, self.name) - checksum = getmd5sum(filename) - mtime = getmtime(filename) - - vprint("\tismodified(%s)" % self.name) - vprint("\t\told: %s / %s" % (self.checksum, self.mtime)) - vprint("\t\tnew: %s / %s" % (checksum, mtime)) + util.vprint("\tismodified(%s)" % self.name) + util.vprint("\t\told: %s / %s" % (self.checksum, self.mtime)) + util.vprint("\t\tnew: %s / %s" % (checksum, mtime)) if self.checksum != checksum \ or (self.mtime[1], self.mtime[2]) != (mtime[1], mtime[2]): - retval = 1 - - return retval - - def resettimes(self): - """ - """ + return 1 - filename = os.path.join(self.root, self.name) - os.utime(filename, (355, 355)) - self.mtime = getmtime(filename) - vprint("\tmtime reset (%s)" % self.name) + return 0 -if __name__ == "__main__": - f = pmfile("/tmp", "foobar") - print f # vim: set ts=4 sw=4 et: |