Skip to content
Browse files
Avoid creating empty colorbox-i18n directory
Signed-off-by: Chris Warrick <>
  • Loading branch information
Kwpolska committed Jun 3, 2017
1 parent f45bafb commit 94379b97a4c392b74827d80a9092b9e34a64c62f
Showing with 14 additions and 4 deletions.
  1. +9 −1 nikola/plugins/task/
  2. +5 −3 nikola/
@@ -80,11 +80,19 @@ def gen_tasks(self):
if ignore_colorbox_i18n == "unused":
# Check what colorbox languages we need so we can ignore the rest
needed_colorbox_languages = [LEGAL_VALUES['COLORBOX_LOCALES'][i] for i in kw['translations']]
needed_colorbox_languages = [i for i in needed_colorbox_languages if i] # remove '' for en
# ignored_filenames is passed to copy_tree to avoid creating
# directories. Since ignored_assets are full paths, and copy_tree
# works on single filenames, we can’t use that here.
if not needed_colorbox_languages:
ignored_filenames = set(["colorbox-i18n"])
ignored_filenames = set()

for theme_name in kw['themes']:
src = os.path.join(utils.get_theme_path(theme_name), 'assets')
dst = os.path.join(kw['output_folder'], 'assets')
for task in utils.copy_tree(src, dst):
for task in utils.copy_tree(src, dst, ignored_filenames=ignored_filenames):
asset_name = os.path.relpath(task['name'], dst)
if task['name'] in tasks or asset_name in ignored_assets:
@@ -738,7 +738,7 @@ def load_messages(themes, translations, default_lang, themes_dirs):
return messages

def copy_tree(src, dst, link_cutoff=None):
def copy_tree(src, dst, link_cutoff=None, ignored_filenames=None):
"""Copy a src tree to the dst folder.
@@ -749,11 +749,13 @@ def copy_tree(src, dst, link_cutoff=None):
should copy "themes/defauts/assets/foo/bar" to
if link_cutoff is set, then the links pointing at things
If link_cutoff is set, then the links pointing at things
*inside* that folder will stay as links, and links
pointing *outside* that folder will be copied.
ignored_filenames is a set of file names that will be ignored.
ignore = set(['.svn'])
ignore = set(['.svn', '.git']) | (ignored_filenames or set())
base_len = len(src.split(os.sep))
for root, dirs, files in os.walk(src, followlinks=True):
root_parts = root.split(os.sep)

0 comments on commit 94379b9

Please sign in to comment.