1
0
Fork 0
forked from github/pelican

Add a feature to copy files from src to dest.

Fixes #86
This commit is contained in:
Alexis Metaireau 2011-05-07 22:46:56 +01:00
commit 04da794b6b
6 changed files with 51 additions and 18 deletions

View file

@ -11,7 +11,7 @@ import random
from jinja2 import Environment, FileSystemLoader
from jinja2.exceptions import TemplateNotFound
from pelican.utils import copytree, get_relative_path, process_translations, open
from pelican.utils import copy, get_relative_path, process_translations, open
from pelican.contents import Article, Page, is_valid_content
from pelican.readers import read_file
from pelican.log import *
@ -298,9 +298,10 @@ class StaticGenerator(Generator):
def _copy_paths(self, paths, source, destination, output_path,
final_path=None):
"""Copy all the paths from source to destination"""
for path in paths:
copytree(path, source, os.path.join(output_path, destination),
final_path)
copy(path, source, os.path.join(output_path, destination), final_path,
overwrite=True)
def generate_output(self, writer):
self._copy_paths(self.settings['STATIC_PATHS'], self.path,
@ -308,6 +309,10 @@ class StaticGenerator(Generator):
self._copy_paths(self.settings['THEME_STATIC_PATHS'], self.theme,
'theme', self.output_path, '.')
# copy all the files needed
for source, destination in self.settings['FILES_TO_COPY']:
copy(source, self.path, self.output_path, destination, overwrite=True)
class PdfGenerator(Generator):
"""Generate PDFs on the output dir, for all articles and pages coming from