Logging for staging, removed unused requirements.
[redakcja.git] / apps / compress / versioning / mtime / __init__.py
1 import os
2
3 from compress.utils import get_output_filename, media_root
4 from compress.versioning.base import VersioningBase
5
6 class MTimeVersioning(VersioningBase):
7
8     def get_version(self, source_files):
9
10         # Return the modification time for the newest source file
11         return str(max([int(os.stat(media_root(f)).st_mtime) for f in source_files]))
12
13     def needs_update(self, output_file, source_files, version):
14
15         output_file_name = get_output_filename(output_file, version)
16         compressed_file_full = media_root(output_file_name)
17
18         return (int(os.stat(compressed_file_full).st_mtime) < int(version)), version
19