diff --git a/sigal/writer.py b/sigal/writer.py index 6ef1570..67ef5df 100644 --- a/sigal/writer.py +++ b/sigal/writer.py @@ -23,9 +23,9 @@ import importlib import logging import os +import shutil import sys import types -from distutils.dir_util import copy_tree import jinja2 from jinja2 import ChoiceLoader, Environment, FileSystemLoader, PrefixLoader @@ -95,7 +95,10 @@ class AbstractWriter: # Copy the theme files in the output dir self.theme_path = os.path.join(self.output_dir, 'static') - copy_tree(os.path.join(self.theme, 'static'), self.theme_path) + if os.path.isdir(self.theme_path): + shutil.rmtree(self.theme_path) + # FIXME: use dirs_exist_ok when minimum Python is 3.8 + shutil.copytree(os.path.join(self.theme, 'static'), self.theme_path) def generate_context(self, album): """Generate the context dict for the given path."""