From 244ba4dda93f975da7d78c21c7897b69e4fde83e Mon Sep 17 00:00:00 2001 From: Ryan M Date: Sun, 29 Dec 2013 21:13:29 -0700 Subject: [PATCH] source files copy as file not as a new directory --- pelican/generators.py | 2 +- pelican/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pelican/generators.py b/pelican/generators.py index 2fbb0e1c..e6dc2266 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -592,7 +592,7 @@ class SourceFileGenerator(Generator): output_path, _ = os.path.splitext(obj.save_as) dest = os.path.join(self.output_path, output_path + self.output_extension) - copy('', obj.source_path, dest) + copy('', obj.source_path, dest, is_file=True) def generate_output(self, writer=None): logger.info(' Generating source files...') diff --git a/pelican/utils.py b/pelican/utils.py index 4b25ec7f..f47253b2 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -256,7 +256,7 @@ def slugify(value, substitutions=()): return value.decode('ascii') -def copy(path, source, destination, destination_path=None): +def copy(path, source, destination, destination_path=None, is_file=False): """Copy path from origin to destination. The function is able to copy either files or directories. @@ -273,7 +273,7 @@ def copy(path, source, destination, destination_path=None): destination_ = os.path.abspath( os.path.expanduser(os.path.join(destination, destination_path))) - if not os.path.exists(destination_): + if not os.path.exists(destination_) and not is_file: os.makedirs(destination_) def recurse(source, destination):