1
0
Fork 0
forked from github/pelican

merge upstream

This commit is contained in:
dave mankoff 2012-06-14 09:31:08 -04:00
commit d93530a6ea
25 changed files with 1318 additions and 58 deletions

View file

@ -5,6 +5,7 @@ import re
import pytz
import shutil
import logging
from collections import defaultdict
from codecs import open as _open
from datetime import datetime
@ -222,9 +223,9 @@ def files_changed(path, extensions):
"""Return the last time files have been modified"""
for root, dirs, files in os.walk(path):
dirs[:] = [x for x in dirs if x[0] != '.']
for file in files:
if any(file.endswith(ext) for ext in extensions):
yield os.stat(os.path.join(root, file)).st_mtime
for f in files:
if any(f.endswith(ext) for ext in extensions):
yield os.stat(os.path.join(root, f)).st_mtime
global LAST_MTIME
mtime = max(file_times(path))
@ -234,6 +235,21 @@ def files_changed(path, extensions):
return False
FILENAMES_MTIMES = defaultdict(int)
def file_changed(filename):
mtime = os.stat(filename).st_mtime
if FILENAMES_MTIMES[filename] == 0:
FILENAMES_MTIMES[filename] = mtime
return False
else:
if mtime > FILENAMES_MTIMES[filename]:
FILENAMES_MTIMES[filename] = mtime
return True
return False
def set_date_tzinfo(d, tz_name=None):
""" Date without tzinfo shoudbe utc.
This function set the right tz to date that aren't utc and don't have