Skip to content

Commit

Permalink
Merge 0c5ae13 into cc4a2ca
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartinm committed Oct 6, 2014
2 parents cc4a2ca + 0c5ae13 commit 4dc9f3f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions flask_collect/storage/file.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from os import path as op, makedirs
from shutil import copy2
from shutil import copy

from .base import BaseStorage

Expand All @@ -8,19 +8,22 @@ class Storage(BaseStorage):

def run(self):
self.log("Collect static from blueprints.")
destination_list = []
for bp, f, o in self:
destination = op.join(self.collect.static_root, o)
destination_dir = op.dirname(destination)
if not op.exists(destination_dir):
makedirs(destination_dir)

if destination in destination_list:
self.log("{0} already copied".format(destination))
if (
not op.exists(destination)
or op.getmtime(destination) < op.getmtime(f)):
copy2(f, destination)
copy(f, destination)
self.log(
"Copied: [%s] '%s'" %
(bp.name,
op.join(
self.collect.static_url,
destination)))
destination_list.append(destination)

0 comments on commit 4dc9f3f

Please sign in to comment.