1. Georg Brandl
  2. sphinx


georg.brandl  committed 898583a

Don't overwrite existing sphinx projects from quickstart.

  • Participants
  • Parent commits 35dc7f6
  • Branches default

Comments (0)

Files changed (2)


View file
   - 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)

File sphinx/quickstart.py

View file
     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