Handle RST files
Do not build all manuals if only RST files are changed. Change-Id: Ie0790d7bebd676c9430a4295fe4421cbd74cbd8c
This commit is contained in:
parent
9912bdd294
commit
fbef0ea1c1
@ -1,6 +1,12 @@
|
|||||||
Release notes
|
Release notes
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
0.23
|
||||||
|
----
|
||||||
|
|
||||||
|
* ``openstack-doc-test``: Don't build all books if only RST files are
|
||||||
|
changed.
|
||||||
|
|
||||||
0.22
|
0.22
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -376,6 +376,27 @@ def only_po_touched():
|
|||||||
return locale_changed and not other_changed
|
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):
|
def check_modified_affects_all(rootdir):
|
||||||
"""Check whether special files were modified.
|
"""Check whether special files were modified.
|
||||||
|
|
||||||
@ -1571,6 +1592,10 @@ def doctest():
|
|||||||
and only_po_touched()):
|
and only_po_touched()):
|
||||||
print("Only files in locale directories changed, nothing to do.\n")
|
print("Only files in locale directories changed, nothing to do.\n")
|
||||||
return
|
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.check_syntax or CONF.check_niceness or CONF.check_links:
|
||||||
if CONF.force:
|
if CONF.force:
|
||||||
|
Loading…
Reference in New Issue
Block a user