From d8de24e1ad8a244986d5c198def32e9508ccd358 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Wed, 24 Sep 2008 15:46:54 +0000 Subject: [PATCH] Don't overwrite existing sphinx projects from quickstart. --- CHANGES | 3 +++ sphinx/quickstart.py | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/CHANGES b/CHANGES index 35b5a722e..71ef9e456 100644 --- a/CHANGES +++ b/CHANGES @@ -100,6 +100,9 @@ New features added - Figures with captions can now be referred to like section titles, using the ``:ref:`` role without an explicit link text. + - In quickstart, if the selected root path already contains a Sphinx + project, complain and abort. + Release 0.4.2 (Jul 29, 2008) ============================ diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index 613a4eb42..d067802ae 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -387,6 +387,19 @@ accept a default value, if one is given in brackets).''' print ''' Enter the root path for documentation.''' do_prompt(d, 'path', 'Root path for the documentation', '.', is_path) + + while path.isfile(path.join(d['path'], 'conf.py')) or \ + path.isfile(path.join(d['path'], 'source', 'conf.py')): + print + print bold('Error: an existing conf.py has been found in the ' + 'selected root path.') + print 'sphinx-quickstart will not overwrite existing Sphinx projects.' + print + do_prompt(d, 'path', 'Please enter a new root path (or just Enter to exit)', + '', is_path) + if not d['path']: + sys.exit(1) + print ''' You have two options for placing the build directory for Sphinx output. Either, you use a directory ".build" within the root path, or you separate