[Python-modules-team] Bug#815631: sphinx: Use alternatives to provide scripts under /usr/bin

Dmitry Shachnev mitya57 at debian.org
Tue Feb 23 07:19:07 UTC 2016


Hi Kevin,

On Tue, Feb 23, 2016 at 02:34:11PM +1100, Kevin Murray wrote:
> I have recently needed to use a python3-only sphinx build process on a
> system with both python-sphinx & python3-sphinx co-installed. IMHO co-installation
> could be a little cleaner and easier if sphinx:
> 
> - Used update-alternatives to provide /usr/bin/sphinx-* in a
>   configurable way. (e.g similar to how docutils handles this problem). This
>   could use the current script installation path under
>   /usr/share/sphinx/scripts/python*/

Let me quote Jakub Wilk, who wrote the current implementation:

  The alternatives mechanism is only suitable if both commands are compatible,
  i.e. their behavior doesn't vary with Python version. This is the case for
  rst2html and friends, but no so much for sphinx-build. The problem is that
  sphinx-build can import 3rd-party Python code, which is not necessarily
  compatible with both Python 2 and 3.

> - Or, installed binaries under /usr/bin with the suffix '3', i.e. install
>   /usr/bin/sphinx-build3. (modelled after pip/pip3 & nosetests/nosetests3 and
>   other similar examples)

The name of sphinx-build command is hardcoded in too many places (i.e. the
Makefiles generated by Sphinx use it). Also, I don't much like the foo/foo3
naming because there is a better way: pythonX[.Y] -m sphinx allows one to
call sphinx-build with *any* Python version (not necessarily the default one).

> - Or, a combination of both these, where python-sphinx and
>   python3-sphinx install /usr/bin/sphinx-*{2,3} respectively, and
>   update-alternatives is used to provide /usr/bin/sphinx-* without
>   prefix.

See above.

> P.S., I know one can always do /usr/share/sphinx/scripts/python3/sphinx-build
> as a workaround.

What is exactly your problem? Does Python 2 sphinx not work with your code?
Can you use python3 -m sphinx there? Or maybe use setuptools' build_sphinx
command?

--
Dmitry Shachnev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20160223/0d05894b/attachment.sig>


More information about the Python-modules-team mailing list