Skip to content

Instantly share code, notes, and snippets.

@troter
Created July 16, 2012 04:34
Show Gist options
  • Save troter/3120580 to your computer and use it in GitHub Desktop.
Save troter/3120580 to your computer and use it in GitHub Desktop.
Sphinx extension for raw files, like a CNAME.
sys.path += ['.']
extensions += ['sphinxcontrib_rawfiles']
# Files you want to copy
rawfiles = ['CNAME']
# -*- coding: utf-8 -*-
import os
import shutil
def on_html_collect_pages(app):
for f in app.builder.config.rawfiles:
src = os.path.join(app.srcdir, f)
dst = os.path.join(app.builder.outdir, f)
if os.path.isfile(src):
shutil.copy(src, dst)
else:
shutil.copytree(src, dst)
return ()
def setup(app):
app.add_config_value('rawfiles', [], 'html')
app.connect("html-collect-pages", on_html_collect_pages)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment