From 3de0efac968a1f5f75f376ef521037de70b554ce Mon Sep 17 00:00:00 2001 From: Steve Martinelli Date: Wed, 22 Oct 2014 16:22:07 -0400 Subject: [PATCH] Remove the unnecessary redirect.py file This should take care of old documents that are moved around, but since we don't have any, let's remove it for now. Change-Id: I69d5faced8847f833d6ee4794592cbb6cb0115f9 --- doc/source/redirect.py | 50 ------------------------------------------ 1 file changed, 50 deletions(-) delete mode 100644 doc/source/redirect.py diff --git a/doc/source/redirect.py b/doc/source/redirect.py deleted file mode 100644 index 099159f..0000000 --- a/doc/source/redirect.py +++ /dev/null @@ -1,50 +0,0 @@ -# A simple sphinx plugin which creates HTML redirections from old names -# to new names. It does this by looking for files named "redirect" in -# the documentation source and using the contents to create simple HTML -# redirection pages for changed filenames. - -import os.path - -from sphinx.application import ENV_PICKLE_FILENAME -from sphinx.util.console import bold - - -def setup(app): - from sphinx.application import Sphinx - if not isinstance(app, Sphinx): - return - app.connect('build-finished', emit_redirects) - - -def process_redirect_file(app, path, ent): - parent_path = path.replace(app.builder.srcdir, app.builder.outdir) - with open(os.path.join(path, ent)) as redirects: - for line in redirects.readlines(): - from_path, to_path = line.rstrip().split(' ') - from_path = from_path.replace('.rst', '.html') - to_path = to_path.replace('.rst', '.html') - - redirected_filename = os.path.join(parent_path, from_path) - redirected_directory = os.path.dirname(redirected_filename) - if not os.path.exists(redirected_directory): - os.makedirs(redirected_directory) - with open(redirected_filename, 'w') as f: - f.write('' - % to_path) - - -def emit_redirects(app, exc): - app.builder.info(bold('scanning %s for redirects...') % app.builder.srcdir) - - def process_directory(path): - for ent in os.listdir(path): - p = os.path.join(path, ent) - if os.path.isdir(p): - process_directory(p) - elif ent == 'redirects': - app.builder.info(' found redirects at %s' % p) - process_redirect_file(app, path, ent) - - process_directory(app.builder.srcdir) - app.builder.info('...done')