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

Current master breaks make clean #13157

Open
jfbu opened this issue Nov 25, 2024 · 2 comments · May be fixed by #13158
Open

Current master breaks make clean #13157

jfbu opened this issue Nov 25, 2024 · 2 comments · May be fixed by #13158
Labels
Milestone

Comments

@jfbu
Copy link
Contributor

jfbu commented Nov 25, 2024

Describe the bug

We can not execute make clean anymore on current Sphinx HEAD

$ make html && make clean
Sphinx v8.2.0+/de24fd0b7 en cours d'exécution
chargement des traductions [en]... fait
chargement de l'environnement pickled... fait
construction en cours [mo] : cibles périmées pour les fichiers po 0
écriture... 
construction [html] : cibles périmées pour les fichiers sources 0
mise à jour de l'environnement : 0 ajouté(s), 0 modifié(s), 0 supprimé(s)
lecture des sources... 
recherche des fichiers périmés... aucun résultat trouvé
aucune cible n'est périmée.
La compilation a réussi.

Les pages HTML sont dans _build/html.
Removing everything under '_build'...
Traceback (most recent call last):
  File "/path/to/work/.venv312/bin/sphinx-build", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/path/to/sphinx/sphinx/cmd/build.py", line 561, in main
    return make_mode.run_make_mode(argv[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/sphinx/sphinx/cmd/make_mode.py", line 222, in run_make_mode
    return getattr(make, run_method)()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/sphinx/sphinx/cmd/make_mode.py", line 90, in build_clean
    rmtree(self.build_dir_join(item))
  File "/path/to/sphinx/sphinx/util/osutil.py", line 243, in rmtree
    os.remove(path)
FileNotFoundError: [Errno 2] No such file or directory: '_build/_build/html'
make: *** [Makefile:20: clean] Error 1

How to Reproduce

sphinx-quickstart then make html && make clean . Install first Sphinx master in a venv.

Environment Information

Platform:              darwin;
Python version:        3.12.3 (v3.12.3:f6650f9ad7, Apr  9 2024, 08:18:48) [Clang 13.0.0 (clang-1300.0.29.30)])
Python implementation: CPython
Sphinx version:        8.2.0+/de24fd0b7
Docutils version:      0.21.2
Jinja2 version:        3.1.4
Pygments version:      2.18.0

Sphinx extensions

none

Additional context

First bad commit is reported by git bisect to be de24fd0

I am on macOS, too old to reveal which one here publicly (I don't want to be attacked by hackers).

@jfbu jfbu added the type:bug label Nov 25, 2024
@jfbu jfbu added this to the 8.2.0 milestone Nov 25, 2024
@jayaddison
Copy link
Contributor

I can confirm this from following the repro steps.

A possible fix:

diff --git a/sphinx/cmd/make_mode.py b/sphinx/cmd/make_mode.py
index 5966b628a..7642b6229 100644
--- a/sphinx/cmd/make_mode.py
+++ b/sphinx/cmd/make_mode.py
@@ -87,7 +87,7 @@ class Make:
             return 1
         print("Removing everything under '%s'..." % self.build_dir)
         for item in self.build_dir.iterdir():
-            rmtree(self.build_dir_join(item))
+            rmtree(item)
         return 0
 
     def build_help(self) -> None:

(the code in HEAD performs a build-dir-relative resolution step for each item-to-clean from the build dir, and that seems to be the bug, I think?)

@jayaddison
Copy link
Contributor

We might also want to use build_dir instead of self.build_dir in that part of the code, I think. I'll open a pull request soon unless anyone else gets to that before me.

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

Successfully merging a pull request may close this issue.

2 participants