Projet

Général

Profil

0001-misc-skip-unmodified-files-in-collectstatic-27025.patch

Frédéric Péters, 07 octobre 2018 12:11

Télécharger (1,95 ko)

Voir les différences:

Subject: [PATCH] misc: skip unmodified files in collectstatic (#27025)

 wcs/qommon/management/commands/collectstatic.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
wcs/qommon/management/commands/collectstatic.py
57 57
                    for filename in filenames:
58 58
                        dst_path = os.path.join(dst_base, basedir[len(directory)+1:])
59 59
                        dst_filename = os.path.join(dst_path, filename)
60
                        src_filename = os.path.join(basedir, filename)
61
                        src_mtime = int(os.stat(src_filename).st_mtime)
62
                        try:
63
                            dst_mtime = int(os.stat(dst_filename).st_mtime)
64
                        except OSError:
65
                            dst_mtime = 0
66
                        if src_mtime <= dst_mtime:
67
                            continue
60 68
                        if not os.path.exists(dst_path):
61 69
                            os.makedirs(dst_path)
62 70
                        if os.path.exists(dst_filename):
63 71
                            os.unlink(dst_filename)
64 72
                        if link:
65
                            os.symlink(os.path.join(basedir, filename), dst_filename)
73
                            os.symlink(src_filename, dst_filename)
66 74
                        else:
67
                            shutil.copy(os.path.join(basedir, filename), dst_filename)
75
                            shutil.copy2(src_filename, dst_filename)
76
                            os.utime(dst_filename, (src_mtime, src_mtime))
68
-