diff options
| author | 2012-12-12 20:15:50 -0300 | |
|---|---|---|
| committer | 2012-12-12 20:15:50 -0300 | |
| commit | 540e6aa6fcd86a98e270715d1d4e49493eacc270 (patch) | |
| tree | ad1b1fcca82d9638f5edcf7a4d9149ca113ba2d2 /nikola/plugins/task_copy_files.py | |
| parent | 25744f4bf462020e353c503db3ec558604c19137 (diff) | |
| parent | 0f2c04e70a0ffdd0892d6970cafbcd952d221db5 (diff) | |
Merge tag 'upstream/5'
Upstream version 5
Diffstat (limited to 'nikola/plugins/task_copy_files.py')
| -rw-r--r-- | nikola/plugins/task_copy_files.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/nikola/plugins/task_copy_files.py b/nikola/plugins/task_copy_files.py new file mode 100644 index 0000000..a053905 --- /dev/null +++ b/nikola/plugins/task_copy_files.py @@ -0,0 +1,35 @@ +import os + +from nikola.plugin_categories import Task +from nikola import utils + + +class CopyFiles(Task): + """Copy static files into the output folder.""" + + name = "copy_files" + + def gen_tasks(self): + """Copy static files into the output folder.""" + + kw = { + 'files_folders': self.site.config['FILES_FOLDERS'], + 'output_folder': self.site.config['OUTPUT_FOLDER'], + 'filters': self.site.config['FILTERS'], + } + + flag = False + for src in kw['files_folders']: + dst = kw['output_folder'] + filters = kw['filters'] + real_dst = os.path.join(dst, kw['files_folders'][src]) + for task in utils.copy_tree(src, real_dst, link_cutoff=dst): + flag = True + task['basename'] = self.name + task['uptodate'] = [utils.config_changed(kw)] + yield utils.apply_filters(task, filters) + if not flag: + yield { + 'basename': self.name, + 'actions': (), + } |
