From 950cf10564f65bfd692ec2d06ab41458c73fd8ad Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Thu, 29 Apr 2010 18:01:58 -0400 Subject: [PATCH] Add -c option to 'python setup.py build_sphinx' to specify the config directory different than the source directory. --- sphinx/setup_command.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sphinx/setup_command.py b/sphinx/setup_command.py index d4f873488..8f68008dc 100644 --- a/sphinx/setup_command.py +++ b/sphinx/setup_command.py @@ -64,6 +64,7 @@ class BuildDoc(Command): ('all-files', 'a', 'build all files'), ('source-dir=', 's', 'Source directory'), ('build-dir=', None, 'Build directory'), + ('config-dir=', 'c', 'Location of the configuration directory'), ('builder=', 'b', 'The builder to use. Defaults to "html"'), ('project=', None, 'The documented project\'s name'), ('version=', None, 'The short X.Y version'), @@ -81,6 +82,7 @@ class BuildDoc(Command): self.version = '' self.release = '' self.today = '' + self.config_dir = None def _guess_source_dir(self): for guess in ('doc', 'docs'): @@ -96,6 +98,8 @@ class BuildDoc(Command): self.announce('Using source directory %s' % self.source_dir) self.ensure_dirname('source_dir') self.source_dir = os.path.abspath(self.source_dir) + if self.config_dir is None: + self.config_dir = self.source_dir if self.build_dir is None: build = self.get_finalized_command('build') @@ -122,7 +126,7 @@ class BuildDoc(Command): confoverrides['release'] = self.release if self.today: confoverrides['today'] = self.today - app = Sphinx(self.source_dir, self.source_dir, + app = Sphinx(self.source_dir, self.config_dir, self.builder_target_dir, self.doctree_dir, self.builder, confoverrides, status_stream, freshenv=self.fresh_env)