-
Notifications
You must be signed in to change notification settings - Fork 23.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move from asciidoc to rst2man to generate man pages #37861
Conversation
test/utils/docker/centos6/Dockerfile
Outdated
@@ -4,7 +4,7 @@ RUN yum clean all && \ | |||
yum -y install epel-release && \ | |||
yum -y install \ | |||
acl \ | |||
asciidoc \ | |||
asciidoctor \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the other containers in the same directory are no longer used to build docs, so they shouldn't be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we just remove asciidoc from there then? I mean it brings a LOT of stuffs with dblatex by default. This would lighten the images too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave them as-is for now. I'm going to be working on newer images and things can be cleaned up then.
8a1f98d
to
362fd94
Compare
Thanks for the review @mattclay :) I removed the changes on the Dockerfile as discussed. |
It looks like |
362fd94
to
9f9278a
Compare
Thanks, done. |
/cc @nitzmahone @abadger |
I think we should move away from asciidoc in favour of using rst or jinja2 templates to generate man pages. The one problem I see with asciidoctor is that it means bringing ing introduces a ruby stack for building docs. I'm not sure what the overlap of people who install from source and people who want docs but those who do probably won't be entirely pleased by that. Dependencies on Fedora:
@alikins I think you were the one who worked on moving the html program documentation away from asciidoc; do you think it would be easy to generate the man pages using the same method? Do you have time to work on that? |
Thanks for the reply @abadger. If you want I can convert your asciidoc man pages to .rst and use either rst2man or sphynx to convert them to man pages. Those 2 are python and would avoid having to maintain a custom converter. |
That sounds good to me, thanks! Eventually we'll want to generate them
from the source but I don't know how much time alikins has for that so it's
better to get something that will work now and we can improve upon it later.
… |
9f9278a
to
71db459
Compare
71db459
to
af5d5af
Compare
Sorry for the late reply @abadger . Thanks, |
@aerostitch Looks good. @dharmabumstead alikins, bcoca, and I like this change. Feel free to merge once you've reviewed. |
Makefile
Outdated
ASCII2HTMLMAN = a2x -L -D docs/html/man/ -d manpage -f xhtml | ||
MANPAGES ?= $(patsubst %.rst.in,%,$(wildcard ./docs/man/man1/ansible*.1.rst.in)) | ||
ifneq ($(shell which rst2man 2>/dev/null),) | ||
ASCII2MAN = rst2man $< $@ | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an extra conditional for rst2man.py
?
If you just pip install docutils
you get a file dropped in bin
with the .py
extension.
Something like:
diff --git a/Makefile b/Makefile
index 112a997e7c..734613e05f 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,8 @@ PREFIX ?= '/usr/local'
MANPAGES ?= $(patsubst %.rst.in,%,$(wildcard ./docs/man/man1/ansible*.1.rst.in))
ifneq ($(shell which rst2man 2>/dev/null),)
ASCII2MAN = rst2man $< $@
+else ifneq ($(shell which rst2man.py 2>/dev/null),)
+ASCII2MAN = rst2man.py $< $@
else
ASCII2MAN = @echo "ERROR: rst2man command is not installed but is required to build $(MANPAGES)" && exit 1
endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @sivel . The problem with that is that if you install it using your package distro you will not get the .py
extension. Example on Debian:
$ dpkg -L python-docutils | grep rst2man
/usr/share/docutils/scripts/python2/rst2man
$ dpkg -L python3-docutils | grep rst2man
/usr/share/docutils/scripts/python3/rst2man
So should we specify a fallback with the non-extension version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about something like:
ifneq ($(shell which rst2man.py 2>/dev/null),)
ASCII2MAN = rst2man.py $< $@
else ifneq ($(shell which rst2man 2>/dev/null),)
ASCII2MAN = rst2man $< $@
else
ASCII2MAN = @echo "ERROR: rst2man from docutils command is not installed but is required to build $(MANPAGES)" && exit 1
endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is what I recommended in my diff; Adding a 2nd branch to check for .py
. I just put the .py
2nd in my example. Preferring rst2man
then rst2man.py
Either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, thanks, sorry I misread :\ . Amended.
af5d5af
to
7578f5f
Compare
@sivel I amended the commit so that it takes in account both |
7578f5f
to
ea9682f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with the additional branch to look for rst2man.py and it works as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Thanks guys! :) |
SUMMARY
Asciidoc is EOL and only supports python2.
Upstream clearly encourages people to move to an equivalent such as asciidoctor, see: https://github.com/asciidoc/asciidoc/releases/tag/8.6.10
As the maintainer of asciidoc in Debian I'm working with the different projects to help the transition, hence the current PR.
ISSUE TYPE
COMPONENT NAME
Makefile =>
make docs command
and corresponding docker installationsANSIBLE VERSION
ADDITIONAL INFORMATION
Note that in the
Makefile
, theASCII2HTMLMAN
seems to be unused (and the command itself was sending an error when trying it directly in the shell. I modified it to have a working command but I doubt it's useful.Let me know if I should remove it.
Thanks for your help!
Joseph