equal
deleted
inserted
replaced
529 raise Exception("Not copying file as read_only mode is set: %s -> %s" % (file, self)) |
529 raise Exception("Not copying file as read_only mode is set: %s -> %s" % (file, self)) |
530 |
530 |
531 # perform the copy |
531 # perform the copy |
532 shutil.copyfile(file.path, self.path) |
532 shutil.copyfile(file.path, self.path) |
533 |
533 |
|
534 def newer_than (self, file) : |
|
535 """ |
|
536 Tests if this file is newer than the given file. |
|
537 |
|
538 Returns True if it is, False if it isn't, or None if either file doesn't exist. |
|
539 |
|
540 XXX: stat cache? |
|
541 """ |
|
542 |
|
543 stat_self = self.stat(soft=True) |
|
544 stat_file = file.stat(soft=True) |
|
545 |
|
546 if stat_self and stat_file : |
|
547 return stat_self.st_mtime > stat_file.st_mtime |
|
548 |
|
549 else : |
|
550 return None |
|
551 |
|
552 def older_than (self, file) : |
|
553 """ |
|
554 Tests if this file is older than the given file. |
|
555 |
|
556 Opposite of newer_than. |
|
557 """ |
|
558 |
|
559 return file.newer_than(self) |
|
560 |
534 class Directory (Node) : |
561 class Directory (Node) : |
535 """ |
562 """ |
536 A directory is a node that contains other nodes. |
563 A directory is a node that contains other nodes. |
537 """ |
564 """ |
538 |
565 |