make weirdness when building docs

Greg Ward greg at gerg.ca
Wed Dec 16 16:14:43 CST 2009


If I have docutils installed in a non-standard location -- i.e. Python
can "import docutils", but my shell cannot find "rst2html" -- then
"make doc" fails in a very strange way.  Example:

$ make doc PYTHON=/usr/bin/python2.6-intelerad
make -C doc
make[1]: Entering directory `/home/gward/src/mercurial-intelerad/doc'
/usr/bin/python2.6-intelerad rst2man.py --halt warning \
          --strip-elements-with-class htmlonly hg.1.txt hg.1
/usr/bin/python2.6-intelerad rst2man.py --halt warning \
          --strip-elements-with-class htmlonly hgignore.5.txt hgignore.5
/usr/bin/python2.6-intelerad rst2man.py --halt warning \
          --strip-elements-with-class htmlonly hgrc.5.txt hgrc.5
which: no rst2html.py in
(/usr/kerberos/bin:/home/gward/bin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/depot/bin:/home/gward/bin:/opt/real/RealPlayer)
halt warning \
          --link-stylesheet --stylesheet-path style.css hg.1.txt hg.1.html
usage: halt [-n] [-w] [-d] [-f] [-h] [-i] [-p]
        -n: don't sync before halting the system
        -w: only write a wtmp reboot record and exit.
        -d: don't write a wtmp record.
        -f: force halt/reboot, don't call shutdown.
        -h: put harddisks in standby mode.
        -i: shut down all network interfaces.
        -p: power down the system (if possible, otherwise halt).
make[1]: [hg.1.html] Error 1 (ignored)
[...repeat several more attempts to run 'halt'...]
"""

Because neither rst2html nor rst2html.py are in my path, the make
variable $(RST2HTML) is set to the empty string.  So make thinks the
command to run is

  --halt warning --link-stylesheet --stylesheet-path style.css
hg.1.txt hg.1.html

and of course, leading "-" means "run the command but ignore its exit
status".  I did not know that leading "--" had the same effect, but
apparently it does.  (GNU make 3.81 on CentOS 5.4.)

Anyways, that's why Mercurial's build is trying to shutdown my system.
 Good thing I wasn't building as root.  ;-)

The workaround is obvious: pass RST2HTML=... on the make command line.
 But I suspect the clever "($shell which rst2html ...)" trick is more
trouble than it's worth.  Either that or it needs a little more
trickery to die horribly if RST2HTML is empty.

I'll try to cook up a patch later tonight.  If anyone beats me to it,
though, that's OK.  ;-)

Greg


More information about the Mercurial-devel mailing list