Handle RST files

Do not build all manuals if only RST files are changed.

Change-Id: Ie0790d7bebd676c9430a4295fe4421cbd74cbd8c
This commit is contained in:
Andreas Jaeger 2015-02-23 14:14:52 +01:00
parent 9912bdd294
commit fbef0ea1c1
2 changed files with 31 additions and 0 deletions

View File

@ -1,6 +1,12 @@
Release notes
=============
0.23
----
* ``openstack-doc-test``: Don't build all books if only RST files are
changed.
0.22
----

View File

@ -376,6 +376,27 @@ def only_po_touched():
return locale_changed and not other_changed
def only_rst_touched():
"""Check whether only RST files are touched."""
try:
git_args = ["git", "diff", "--name-only", "HEAD~1", "HEAD"]
modified_files = check_output(git_args).strip().split()
except (subprocess.CalledProcessError, OSError) as e:
print("git failed: %s" % e)
sys.exit(1)
rst_changed = False
other_changed = False
for f in modified_files:
if f.endswith(".rst"):
rst_changed = True
else:
other_changed = True
return rst_changed and not other_changed
def check_modified_affects_all(rootdir):
"""Check whether special files were modified.
@ -1571,6 +1592,10 @@ def doctest():
and only_po_touched()):
print("Only files in locale directories changed, nothing to do.\n")
return
# If only RST files are touched, there's nothing to do.
if (not CONF.force and only_rst_touched()):
print("Only RST files changed, nothing to do.\n")
return
if CONF.check_syntax or CONF.check_niceness or CONF.check_links:
if CONF.force: