Skip to content

make-mode: use sys.argv[0] instead of sys.executable + "sphinx-build ..." #3400

@FRidh

Description

@FRidh

Problem

make-mode invokes python sphinx-build arguments. In our distribution we wrap all executable files and this is now broken because sphinx-build assumes it can just run python sphinx-build

Procedure to reproduce the problem

make html

e.g.

Error logs / results

$ make html
  File "/nix/store/r9p2wdbaz1ll67cqvr97zvhih7yvyhn2-python3.5-Sphinx-1.5.1/bin/sphinx-build", line 2
    export PATH=/nix/store/8qn95swyn4higc63c1rlaacvwkz6iaw7-python3-3.5.2/bin:/nix/store/r9p2wdbaz1ll67cqvr97zvhih7yvyhn2-python3.5-Sphinx-1.5.1/bin:/nix/store/rmhvpa9m94m4iniamnldy9y9l3kgx921-python3.5-docutils-0.13.1/bin:/nix/store/xrlbgkpz9ksvbhj11iwvv1844ryfy4i5-python3.5-setuptools-30.2.0/bin:/nix/store/f8ijxyzx7ilzxpbkpvydnqyxrxb13gx8-python3.5-Pygments-2.1.3/bin:/nix/store/i1zrk7ia2qac7mp3a39p9gmily04bxpv-python3.5-Babel-2.3.4/bin${PATH:+:}$PATH
              ^
SyntaxError: invalid syntax
make: *** [Makefile:20: html] Error 1

What you see here is the contents of our wrapper.

Expected results

If sphinx-build is an executable program, then it should be executed directly, instead of by calling Python on it.

We can patch it ourselves, but I think it is better if Sphinx wouldn't use Python to invoke sphinx-build. On most systems sys.argv[0] will return the full filename, so that should be sufficient.

Environment info

  • OS: Nix, NixOS
  • Python version: Any
  • Sphinx version: 1.5.1

Downstream issue NixOS/nixpkgs#22501

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions