Don't overwrite existing sphinx projects from quickstart.

This commit is contained in:
Georg Brandl 2008-09-24 15:46:54 +00:00
parent 47ce40c492
commit d8de24e1ad
2 changed files with 16 additions and 0 deletions

View File

@ -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)
============================

View File

@ -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