summaryrefslogtreecommitdiff
path: root/sphinx/setup_command.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-02-17 10:49:53 +0100
committerGeorg Brandl <georg@python.org>2010-02-17 10:49:53 +0100
commitce67f3457c9bb608fc70eb09bb000190059a5105 (patch)
tree1b549708fbc7160cc83292baae383800030b9358 /sphinx/setup_command.py
parentfebd005784c82cd5ba705d0cc822b9a68f674a82 (diff)
parentdd1d2974e9329db35ae8afbc75ca8e1ca25c6b80 (diff)
downloadsphinx-ce67f3457c9bb608fc70eb09bb000190059a5105.tar.gz
merge with trunk
Diffstat (limited to 'sphinx/setup_command.py')
-rw-r--r--sphinx/setup_command.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/sphinx/setup_command.py b/sphinx/setup_command.py
index 1b434fa2..d569b031 100644
--- a/sphinx/setup_command.py
+++ b/sphinx/setup_command.py
@@ -41,14 +41,18 @@ class BuildDoc(Command):
self.conf_file_name = 'conf.py'
self.builder = 'html'
+ def _guess_source_dir(self):
+ for guess in ('doc', 'docs'):
+ if not os.path.isdir(guess):
+ continue
+ for root, dirnames, filenames in os.walk(guess):
+ if 'conf.py' in filenames:
+ return root
+
def finalize_options(self):
if self.source_dir is None:
- if os.path.isdir('doc'):
- for root, dirnames, filenames in os.walk('doc'):
- if 'conf.py' in filenames:
- self.source_dir = root
- self.announce('Using source directory %s' % root)
- break
+ self.source_dir = self._guess_source_dir()
+ self.announce('Using source directory %s' % self.source_dir)
self.ensure_dirname('source_dir')
self.source_dir = os.path.abspath(self.source_dir)