Locating Python 2.x command for compiling doc

25 views
Skip to first unread message

Dirk Ullrich

unread,
Jul 25, 2012, 8:35:30 AM7/25/12
to smart-...@googlegroups.com
Hello,

I've noted that the Python script `doc/compile-doc.py' used for
generating HTML documentation works only with Python 2.x. Furthermore
it is called in the rake file by `sh doc/compile-doc.py ...'. Thus
locating of the Python command to use relies on the
`#!/usr/bin/python' line in the script.

Therefore the working of `doc/compile-doc.py' makes the asumption that
there is a Python 2 command at `/usr/bin/python'. This does not work,
for instance, for Arch Linux: On such a system `/usr/bin/python' is
Python 3; the Python 2 command would be at `/usr/bin/python2'. It
would also not work with Python 2 installation below `/usr/local'.

Thus I've implemented a in the rake file a search for a Python 2
command following the following heuristics: First we try to locate
`python2' whithin $PATH, and if this fails, we are looking for
`python' in $PATH. The diff appended patches `Rakefile' for doing
this.

Two caveats for my patch. I am not a Ruby programmer, so my
implementation my be a little bit clumsy. And and works only for
UNIX-like systems - but could easily enhanced for platform
independence (by enhancing the `which' function - see, for instance,
http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby).

Dirk
py2_search.diff

Joao

unread,
Jul 25, 2012, 12:41:39 PM7/25/12
to smart-...@googlegroups.com
Hi Dirk,

I would not bother much with trying to compile the .rst docs with the python script since there have been almost no changes to the doc, and I am trying to rewrite it. See my reply to the thread "Changelog for 0.7.0 and up?" and concentrate your efforts in the new documentation if you can.

Thanks,
João

Dirk Ullrich

unread,
Jul 25, 2012, 3:09:38 PM7/25/12
to smart-...@googlegroups.com
Hello João,

2012/7/25 Joao <joaot...@gmail.com>:
> Hi Dirk,
>
> I would not bother much with trying to compile the .rst docs with the python
> script since there have been almost no changes to the doc, and I am trying
> to rewrite it. See my reply to the thread "Changelog for 0.7.0 and up?" and
> concentrate your efforts in the new documentation if you can.
>
oops, than my attempt was a nice Ruby exercise.

Dirk
Reply all
Reply to author
Forward
0 new messages