3 # Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
30 def __init__(self
, root
, name
):
34 filename
= os
.path
.join(self
.root
, self
.name
)
35 self
.checksum
= getmd5sum(filename
)
36 self
.mtime
= getmtime(filename
)
39 return "%s (%s / %lu)" % (self
.name
, self
.checksum
, self
.mtime
)
47 filename
= os
.path
.join(self
.root
, self
.name
)
48 checksum
= getmd5sum(filename
)
49 mtime
= getmtime(filename
)
51 vprint("\tismodified(%s)" % self
.name
)
52 vprint("\t\told: %s / %s" % (self
.checksum
, self
.mtime
))
53 vprint("\t\tnew: %s / %s" % (checksum
, mtime
))
55 if self
.checksum
!= checksum \
56 or (self
.mtime
[1], self
.mtime
[2]) != (mtime
[1], mtime
[2]):
62 if __name__
== "__main__":
63 f
= pmfile("/tmp", "foobar")
65 # vim: set ts=4 sw=4 et: