1. Execute make html in the project directory oldproject (this directory contains the cony.py file and index.rst file, as well as the Makefile file), making sure that no new html files are generated. 2. Copy the entire project directory oldproject to another disk and rename it to test. 3. Check the time attribute of the html file in the test/_build/html directory: stat index.html, and the output will be the time when the project directory was copied. 4. Three minutes later, in the test directory (this directory contains the cony.py file and the index.rst file, as well as the Makefile file), execute find . -name "*.html" -exec touch {} + command. 5. Check the time attribute of the html file in the test/_build/html directory: stat index.html, the output is the current time, which is about 4 minutes later than the project directory copy time. 6. Execute make html in the test/ directory. 7. Result: All html files are regenerated.
In the above process, the touch index.rst file was not executed in the test/ directory. After that, I deleted the whole test directory, then repeated the above 7 steps, but added one step before step 6: touch index.rst. Finally when make html, it still generated all the html files. After that, I deleted the whole new project directory and repeated the 7 steps above again, but this time instead of using the touch command before the step6, I modified the content of the index.rst file in the test/ directory: added some text. Finally when make html, it still generated all the html files. So, modifying the time property of the html file (atime mtime ctime) seems to be invalid for now. ========================== ps: I am not sure if it is related to the following environmental situation: OS: debian11 sphinx-bulider --version : 5.3.0. The installation method for sphinx is: sudo apt install python3-sphinx python3-sphinx-rtd-theme. 在2023年4月22日星期六 UTC+8 04:35:09<antl...@youngman.org.uk> 写道: This is basically what I've been saying, and ycproject appears to have tried that. It hasn't worked. It's a bummer, but just accept that if you copy the repository, make will get confused. Cheers, Wol On 21/04/2023 15:15, Kevin Cole wrote: > Sent April 19... > > ---------- Forwarded message --------- > From: *Kevin Cole* <dc....@gmail.com <mailto:dc....@gmail.com>> > Date: Wed, Apr 19, 2023 at 7:22 PM > Subject: Re: [sphinx-users] How can I create html only from the modified > .rst files after changing the project directory? > To: ycproject <class...@gmail.com <mailto:class...@gmail.com>> > > On Wed, Apr 19, 2023 at 6:18 PM ycproject <class...@gmail.com > <mailto:class...@gmail.com>> wrote: > > How can I create html only from modified .rst files? > > I copied the whole project to another disk and only modified a few > .rst files, but after running make html, all the .rst files are > regenerated into html files. (There are hundreds of .rst files in > the whole project) > > I want to generate html only for those .rst files that have been > modified, and for the unmodified .rst files, don't generate new html > files. > > Translated with www.DeepL.com/Translator > <http://www.DeepL.com/Translator> (free version) > > > I am not 100% confident, but I suspect the problem is that you copied > without keeping the original creation dates on the files. > > Sphinx is comparing the new dates of the RST files to the new dates of > the HTML files: If the date of an RST file is newer than the date a > generated HTML, Sphinx will assume that the HTML file older than the RST > and needs to be regenerated. > > If you are on a Linux system, you could issue a command from the root > directory of your project like: > > find . -name "*.html" -exec touch {} + > > This would search all subdirectories for HTML files and "touch" them > without changing anything, which forces the dates to be set to "now". > > Then: > > touch filename.rst > > for each of the "few modified files" so that their date is newer than > the HTML files. Now, MOST of the RST files will be "older" than the HTML > files and the system will see no need to regenerate them. > > -- > You received this message because you are subscribed to the Google > Groups "sphinx-users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to sphinx-users...@googlegroups.com > <mailto:sphinx-users...@googlegroups.com>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sphinx-users/CA%2BpvXRcTvtB5003%2BSDLWGX4qeRdZQ-40RDxDNrF23w7D8RFMZQ%40mail.gmail.com < https://groups.google.com/d/msgid/sphinx-users/CA%2BpvXRcTvtB5003%2BSDLWGX4qeRdZQ-40RDxDNrF23w7D8RFMZQ%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "sphinx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/8d233385-8e23-40dd-b7cb-8bd16474fa95n%40googlegroups.com.