diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-10-27 19:54:00 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-10-27 19:54:00 +0200 |
commit | 68335c53d0360faacf3ce1c326a04345da2bcf33 (patch) | |
tree | e43b903ac56b56f329b998e4e7aef8f46b45c445 /ick-html | |
parent | c96b7b8e73b07ffbd933bec303121aa0c62130b2 (diff) | |
download | ick-68335c53d0360faacf3ce1c326a04345da2bcf33.tar.gz |
Keep mtimes of files consistent
Diffstat (limited to 'ick-html')
-rwxr-xr-x | ick-html | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -79,20 +79,21 @@ class IckHTML(cliapp.Application): for build in project.builds: build_dir = os.path.join( html_dir, project.name, str(build.build_number)) - os.makedirs(build_dir) + if not os.path.exists(build_dir): + os.makedirs(build_dir) self.copy_build_log(build, build_dir) self.copy_build_artifacts(statedir, project, build, build_dir) def copy_build_log(self, build, build_dir): orig = build.get_build_log_filename() target = os.path.join(build_dir, 'build_log.txt') - shutil.copy(orig, target) + shutil.copy2(orig, target) def copy_build_artifacts(self, statedir, project, build, build_dir): artifacts = build.get_artifacts_directory() target = os.path.join(build_dir, 'build_log.txt') for artifact in glob.glob(os.path.join(artifacts, '*')): - shutil.copy(artifact, build_dir) + shutil.copy2(artifact, build_dir) def create_project_html(self, statedir, project, env, html_dir): @@ -101,9 +102,18 @@ class IckHTML(cliapp.Application): } template = env.get_template('project.j2') - with open(os.path.join(html_dir, '%s.html' % project.name), 'w') as f: + html_file = os.path.join(html_dir, '%s.html' % project.name) + with open(html_file, 'w') as f: f.write(template.render(**vars)) + self.copy_mtime( + statedir.get_project_state_path(project.name), + html_file) + + def copy_mtime(self, orig_filename, dest_filename): + st = os.lstat(orig_filename) + os.utime(dest_filename, (long(st.st_atime), long(st.st_mtime))) + if __name__ == '__main__': IckHTML().run() |