diff options
author | Georg Brandl <georg@python.org> | 2011-10-07 12:47:42 +0200 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2011-10-07 12:47:42 +0200 |
commit | 853cfbf7b61a6b33f4bb81e85b7921255590e992 (patch) | |
tree | 78856bb644c29d3998090c995bb5a95a742e8c75 /sphinx/apidoc.py | |
parent | ff940a16b61d15bb77d1d265cecd33788b5f01ec (diff) | |
download | sphinx-git-853cfbf7b61a6b33f4bb81e85b7921255590e992.tar.gz |
Do not overwrite files without -f given.
Diffstat (limited to 'sphinx/apidoc.py')
-rw-r--r-- | sphinx/apidoc.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py index 34381be0c..5b6163ddd 100644 --- a/sphinx/apidoc.py +++ b/sphinx/apidoc.py @@ -269,11 +269,14 @@ Note: By default this script will not overwrite already created files.""") parser.error('An output directory is required.') if opts.header is None: opts.header = rootpath + if opts.suffix.startswith('.'): + opts.suffix = opts.suffix[1:] if not path.isdir(rootpath): print >>sys.stderr, '%s is not a directory.' % rootpath sys.exit(1) if not path.isdir(opts.destdir): - os.makedirs(opts.destdir) + if not opts.dryrun: + os.makedirs(opts.destdir) excludes = normalize_excludes(rootpath, excludes) modules = recurse_tree(rootpath, excludes, opts) if opts.full: @@ -295,7 +298,7 @@ Note: By default this script will not overwrite already created files.""") version = opts.version or '', release = opts.release or opts.version or '', suffix = '.' + opts.suffix, - master = 'modules', + master = 'index', epub = True, ext_autodoc = True, makefile = True, @@ -303,9 +306,7 @@ Note: By default this script will not overwrite already created files.""") mastertocmaxdepth = opts.maxdepth, mastertoctree = text, ) - # XXX overwrites even without --force if not opts.dryrun: - qs.generate(d, silent=True) - print 'Creating quickstart project and Makefile.' + qs.generate(d, silent=True, overwrite=opts.force) elif not opts.notoc: create_modules_toc_file(modules, opts) |