Skip to content

bpo-44756: in ./Doc, make build depends on make html #27403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2021

Conversation

jdevries3133
Copy link
Contributor

@jdevries3133 jdevries3133 commented Jul 28, 2021

  • venv rule is now conditional, and only does anything if $VENVDIR does not
    exist
  • add rule "clean-venv"
  • as a result, rules dependent on build are now dependent on venv:
    • html
    • latex
    • etc.
  • update Doc/README.rst appropriately. Now users usually only need to type
    "make html"

https://bugs.python.org/issue44756

* venv rule is now conditional, and only does anything if $VENVDIR does not
  exist
* add rule "clean-venv"
* as a result, rules dependent on build are now dependent on venv:
  * html
  * latex
  * etc.
* update Doc/README.rst appropriately. Now users usually only need to type
  "make html"
-rm -rf build/*

clean-venv:
rm -rf $(VENVDIR)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note this change:

- rm -rf $(VENVDIR)/*
+ rm -rf $(VENVDIR)

The reason for the change is that it simplifies the conditional action in the venv rule:

# this works but smells bad because it's arbitrarily checking only venv/bin
[ -d $(VENVDIR)/bin ]
# checking venv/bin, venv/lib, venv/include seems superfluous
[ -d $(VENVDIR) ]  # this is nice

However, rm -rf'ing an additional level higher is always worth a close review.

Copy link
Contributor

Choose a reason for hiding this comment

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

I note that you're no longer ignoring the exit code here. Since -f is used anyway, the likelihood of a non-zero exit code from rm is indeed low but it can still fail due to wrong permissions. Arguably, your current version is therefore better then.

(configurable with the SPHINXBUILD and BLURB variables).
The virtual environment in the ``venv`` directory will contain all the tools
necessary to build the documentation. You can also configure where the virtual
environment directory will be with the ``VENVDIR`` variable.

On Windows, we try to emulate the Makefile as closely as possible with a
``make.bat`` file. If you need to specify the Python interpreter to use,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not a Windows user, and I do not know if make.bat needs changes as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

make.bat doesn't use a virtual environment, so nothing to do here.

@corona10 corona10 requested a review from JulienPalard July 28, 2021 05:18
-rm -rf build/*

clean-venv:
rm -rf $(VENVDIR)
Copy link
Contributor

Choose a reason for hiding this comment

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

I note that you're no longer ignoring the exit code here. Since -f is used anyway, the likelihood of a non-zero exit code from rm is indeed low but it can still fail due to wrong permissions. Arguably, your current version is therefore better then.

(configurable with the SPHINXBUILD and BLURB variables).
The virtual environment in the ``venv`` directory will contain all the tools
necessary to build the documentation. You can also configure where the virtual
environment directory will be with the ``VENVDIR`` variable.

On Windows, we try to emulate the Makefile as closely as possible with a
``make.bat`` file. If you need to specify the Python interpreter to use,
Copy link
Contributor

Choose a reason for hiding this comment

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

make.bat doesn't use a virtual environment, so nothing to do here.

@ambv ambv added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels Jul 28, 2021
@ambv ambv merged commit d22c876 into python:main Jul 28, 2021
@bedevere-bot
Copy link

@ambv: Please replace # with GH- in the commit message next time. Thanks!

@miss-islington
Copy link
Contributor

Thanks @jdevries3133 for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 28, 2021
)

- venv rule is now conditional, and only does anything if $VENVDIR does not exist
- add rule "clean-venv"
(cherry picked from commit d22c876)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Jul 28, 2021
@bedevere-bot
Copy link

GH-27410 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 28, 2021
)

- venv rule is now conditional, and only does anything if $VENVDIR does not exist
- add rule "clean-venv"
(cherry picked from commit d22c876)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Jul 28, 2021
@bedevere-bot
Copy link

GH-27411 is a backport of this pull request to the 3.9 branch.

ambv pushed a commit that referenced this pull request Jul 28, 2021
…H-27410)

- venv rule is now conditional, and only does anything if $VENVDIR does not exist
- add rule "clean-venv"
(cherry picked from commit d22c876)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
ambv pushed a commit that referenced this pull request Jul 28, 2021
…H-27411)

- venv rule is now conditional, and only does anything if $VENVDIR does not exist
- add rule "clean-venv"
(cherry picked from commit d22c876)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
@jdevries3133 jdevries3133 deleted the bpo-44756-doc-make branch August 3, 2021 17:35
jdevries3133 added a commit to jdevries3133/cpython that referenced this pull request Aug 3, 2021
@gvanrossum
Copy link
Member

There is something confusing about the commit title. It says “X depends on Y.” It doesn’t say (and I don’t know the situation well enough to deduce) whether that is good or bad, and whether the commit makes it so or removes the dependency. (Reading the code confuses me even more because Y is not actually mentioned in the diff.)

Please do not write such ambiguous commit titles. Alway phrase it in terms of what the commit changes. (And reviewers, please fix the commit title if a contributor writes such a commit title — it seems that there are projects where this style is actually preferred, and we can’t educate all contributors, so we have to do this in the review.)

@ambv
Copy link
Contributor

ambv commented Aug 4, 2021

Alright, @gvanrossum, will do. In this case the typical "Make X do Y" unambiguous commit title would have been somewhat confusing on its own when X starts with "make" so I left it alone. Will do better next time.

@gvanrossum
Copy link
Member

Great. But shouldn’t the title have said “venv” instead of “html”? AFAICT “html” actually depends on “build” and that hasn’t changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants