sphinx-quickstart now allows a project version is empty

This commit is contained in:
Takeshi KOMIYA 2016-07-21 01:13:39 +09:00
parent d651613583
commit d6357a878d
2 changed files with 12 additions and 6 deletions

View File

@ -35,6 +35,7 @@ Incompatible changes
* latex: To provide good default settings to Japanese docs, Sphinx uses * latex: To provide good default settings to Japanese docs, Sphinx uses
``jreport`` and ``jsbooks`` as a docclass by default if the `language` is ``jreport`` and ``jsbooks`` as a docclass by default if the `language` is
``ja``. ``ja``.
* `sphinx-quickstart` now allows a project version is empty
Features added Features added

View File

@ -1124,6 +1124,10 @@ def is_path(x):
return x return x
def allow_empty(x):
return x
def nonempty(x): def nonempty(x):
if not x: if not x:
raise ValidationError("Please enter some text.") raise ValidationError("Please enter some text.")
@ -1296,9 +1300,9 @@ software. Each version can have multiple releases. For example, for
Python the version is something like 2.5 or 3.0, while the release is Python the version is something like 2.5 or 3.0, while the release is
something like 2.5.1 or 3.0a1. If you don't need this dual structure, something like 2.5.1 or 3.0a1. If you don't need this dual structure,
just set both to the same value.''') just set both to the same value.''')
do_prompt(d, 'version', 'Project version') do_prompt(d, 'version', 'Project version', '', allow_empty)
if 'release' not in d: if 'release' not in d:
do_prompt(d, 'release', 'Project release', d['version']) do_prompt(d, 'release', 'Project release', d['version'], allow_empty)
if 'language' not in d: if 'language' not in d:
print(''' print('''
@ -1640,13 +1644,14 @@ def main(argv=sys.argv):
try: try:
if 'quiet' in d: if 'quiet' in d:
if not set(['project', 'author', 'version']).issubset(d): if not set(['project', 'author']).issubset(d):
print('''"quiet" is specified, but any of "project", \ print('''"quiet" is specified, but any of "project" or \
"author" or "version" is not specified.''') "author" is not specified.''')
return return
if set(['quiet', 'project', 'author', 'version']).issubset(d): if set(['quiet', 'project', 'author']).issubset(d):
# quiet mode with all required params satisfied, use default # quiet mode with all required params satisfied, use default
d.setdefault('version', '')
d.setdefault('release', d['version']) d.setdefault('release', d['version'])
d2 = DEFAULT_VALUE.copy() d2 = DEFAULT_VALUE.copy()
d2.update(dict(("ext_"+ext, False) for ext in EXTENSIONS)) d2.update(dict(("ext_"+ext, False) for ext in EXTENSIONS))