Skip to content
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

.gitignore seems a bit too aggressive or make distclean isn't aggressive enough #97731

Closed
smontanaro opened this issue Oct 2, 2022 · 4 comments
Labels
3.10 only security fixes 3.11 only security fixes 3.12 bugs and security fixes build The build process and cross-build deferred-blocker type-bug An unexpected behavior, bug, or error

Comments

@smontanaro
Copy link
Contributor

smontanaro commented Oct 2, 2022

Bug report

I recently moved from Linux back to a Mac. After a bunch of rsync commands I started to make sure stuff worked. When I got to my cpython repo, I couldn't get test_tools to pass because it continued to try and find a nonexistent Conda version of Python 3.9. (That always existed on my Linux box, so the problem was masked there.) Af first, I thought it was the Conda setup on the Mac, but eventually realized that the .../Doc/venv/binpython3 symlink was to the old Linux path. I eventually dumped .../Doc/venv altogether, after which everything worked as expected.

Your environment

My old environment was Ubuntu 22.04 LTS with a miniconda installation whose base Python executable was 3.9. My new environment is a Mac M1 running Monterey with a miniconda installation also using 3.9 as its base Python interpreter. The difference in paths though (/home/skip/miniconda3/... vs /Users/skip/miniconda3/...) exposed the problem.

  • CPython versions tested on:

Up-to-date CPython repo on main branch.

  • Operating system and architecture:

MacOS Monterey (M1 architecture)

Proposed solution:

While it's nice that the .gitignore file hides a bunch of extraneous detail, in this case I think it might have been nice if Doc/venv was revealed as not under Git's control. Alternately, it seems like make distclean should remove that directory.

Oddly enough, looking at the docclean target in the top-level Makefile, I see that it doesn't use the clean target in Doc/Makefile to do its dirty work. Nor is it used by any of the cleaner targets in that file.

docclean:
	-rm -rf Doc/build
	-rm -rf Doc/tools/sphinx Doc/tools/pygments Doc/tools/docutils

The two targets don't even clean up the same cruft. Here are the cleaner targets from Doc/Makefile

clean: clean-venv
	-rm -rf build/*

clean-venv:
	rm -rf $(VENVDIR)

Doc/tools/{sphinx,pygments,docutils} doesn' exist after executing make -C Doc html. I suspect the docclean target could simply be replaced by make -C Doc clean, and made a dependency of the distclean target.

@smontanaro smontanaro added the type-bug An unexpected behavior, bug, or error label Oct 2, 2022
orsenthil pushed a commit that referenced this issue Oct 4, 2022
fix distclean target to clean docs
orsenthil added a commit that referenced this issue Oct 4, 2022
Backport  gh-97731: fix distclean target to clean docs #97732 to 3.11
orsenthil added a commit that referenced this issue Oct 4, 2022
Backport  gh-97731: fix distclean target to clean docs #97732 to 3.10
@tiran tiran added build The build process and cross-build 3.11 only security fixes 3.10 only security fixes deferred-blocker 3.12 bugs and security fixes labels Oct 24, 2022
@tiran
Copy link
Member

tiran commented Oct 24, 2022

The changeset broke out-of-tree builds. The Docs directory is in $(srcdir), not in the current $(builddir).

make -C Doc clean
make[1]: *** Doc: No such file or directory.  Stop.
make: *** [Makefile:2593: docclean] Error 2

@tiran tiran reopened this Oct 24, 2022
@brettcannon
Copy link
Member

On Discord there were two suggested solutions to this:

test -d Doc && $(MAKE) -C Doc clean

or:

make -C $(srcdir)/Doc clean

which is a simpler version of:

docdir=$(srcdir)/Doc
docclean:
    test -d $(docdir) && $(MAKE) -C $docdir clean

@brettcannon
Copy link
Member

Another solution is you can apparently put a - in front of a command which tells Make to ignore errors and continue on. This also seems to be supported by bmake (see the .IGNORE section of the docs).

@brettcannon
Copy link
Member

I'm using #98982 to try out the $(srcdir) solution, and if that doesn't work then I will try the - solution.

brettcannon added a commit that referenced this issue Nov 2, 2022
…8982)

Specify the full path to the docs for `make docclean`
This is to have `make clean` not error out on cross-builds.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 2, 2022
…pythonGH-98982)

Specify the full path to the docs for `make docclean`
This is to have `make clean` not error out on cross-builds.
(cherry picked from commit 22bab74)

Co-authored-by: Brett Cannon <brett@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 2, 2022
…pythonGH-98982)

Specify the full path to the docs for `make docclean`
This is to have `make clean` not error out on cross-builds.
(cherry picked from commit 22bab74)

Co-authored-by: Brett Cannon <brett@python.org>
miss-islington added a commit that referenced this issue Nov 2, 2022
…8982)

Specify the full path to the docs for `make docclean`
This is to have `make clean` not error out on cross-builds.
(cherry picked from commit 22bab74)

Co-authored-by: Brett Cannon <brett@python.org>
brettcannon pushed a commit that referenced this issue Nov 2, 2022
GH-98982) (#99025)

Specify the full path to the docs for `make docclean`
This is to have `make clean` not error out on cross-builds.
(cherry picked from commit 22bab74)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.10 only security fixes 3.11 only security fixes 3.12 bugs and security fixes build The build process and cross-build deferred-blocker type-bug An unexpected behavior, bug, or error
Projects
Development

No branches or pull requests

4 participants