def check_module_timestamps(self, module_path=False, mtime=0):
extensions = ('.py', '.xml', '.csv')
"Walk the tree of a module to find the last updated file"
for file in os.listdir(module_path):
file_path = os.path.join(module_path, file)
statinfo = os.stat(file_path)
file_mtime = 0
if stat.S_ISDIR(statinfo.st_mode):
file_mtime = self.check_module_timestamps(file_path)
elif stat.S_ISREG(statinfo.st_mode):
if any(file.endswith(ex) for ex in extensions):
file_mtime = statinfo.st_mtime
else:
raise Exception(
'Unknown file mode in module path %s' % file_path)
if file_mtime > mtime:
mtime = file_mtime
return mtime
评论列表
文章目录