Skip to content

Default SPHINXBUILD to 'python -msphinx' instead of 'sphinx-build'. - #3523

Merged
tk0miya merged 1 commit into
sphinx-doc:masterfrom
anntzer:makefile-use--msphinx
Mar 8, 2017
Merged

tk0miya merged 1 commit into
sphinx-doc:masterfrom
anntzer:makefile-use--msphinx

Conversation

@anntzer

@anntzer anntzer commented Mar 7, 2017

Copy link
Copy Markdown
Contributor

Subject: Default SPHINXBUILD to 'python -msphinx' instead of 'sphinx-build'.

Feature or Bugfix

  • Feature

Purpose

Using python -msphinx as the default for SPHINXBUILD in the
Makefile/make.bat ensures that whatever virtual environment is currently
active (if any) gets picked up. In the current situation, imaging that
we are working on project $foo which is also installed system-wide,
but we want to build docs for a venv-installed version; that sphinx
is installed system-wide but not in the current environment, and that
e.g. conf.py imports $foo (e.g. to retrieve a version string). Then
sphinx-build will resolve to the globally installed version, and the
global (wrong) version of $foo will be imported as well.

With this fix, make html will do everything in the correct virtualenv
(if any). This switch is similar in spirit to e.g. the deprecation of
the pyvenv script in Py3.6, in favor of python -mvenv.

Using `python -msphinx` as the default for SPHINXBUILD in the
Makefile/make.bat ensures that whatever virtual environment is currently
active (if any) gets picked up.  In the current situation, imaging that
we are working on project $foo which is also installed system-wide,
but we want to build docs for a venv-installed version; that sphinx
is installed system-wide but not in the current environment, and that
e.g. conf.py imports $foo (e.g. to retrieve a version string).  Then
sphinx-build will resolve to the globally installed version, and the
global (wrong) version of $foo will be imported as well.

With this fix, `make html` will do everything in the correct virtualenv
(if any).  This switch is similar in spirit to e.g. the deprecation of
the `pyvenv` script in Py3.6, in favor of `python -mvenv`.

@tk0miya tk0miya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+0; no special opinion for this.

I'd like to hear an advice from @shimizukawa.

@tk0miya
tk0miya requested a review from shimizukawa March 8, 2017 06:00
@tk0miya tk0miya added this to the 1.6 milestone Mar 8, 2017

@shimizukawa shimizukawa left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objection from me.

@tk0miya
tk0miya merged commit 142344c into sphinx-doc:master Mar 8, 2017
@tk0miya

tk0miya commented Mar 8, 2017

Copy link
Copy Markdown
Member

Merged. Thank you for contribution!
@shimizukawa thank you for comment!

@anntzer
anntzer deleted the makefile-use--msphinx branch March 8, 2017 07:15
@peterjc

peterjc commented Sep 20, 2017

Copy link
Copy Markdown
Contributor

Breaks if sphinx is installed under Python 3 but not under Python 2 (i.e. if python defaults to the wrong Python), reported as #3965.

@anntzer

anntzer commented Sep 20, 2017

Copy link
Copy Markdown
Contributor Author

This is actually the intent of the code, as documented in the original message...

@tk0miya

tk0miya commented Oct 21, 2017

Copy link
Copy Markdown
Member

I decided to revert this on 1.6.5. I understand this is useful for your situation, but this confuses other people at same time.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants