In other words, if I understand you correctly, you are saying that actually you NEED to do a complete rebuild on copy (or more especially, move)?

Because all the absolute paths in the output are no longer valid?

In which case, ycproject should not be worried about this, make is working as designed, and "fixing" his project will actually break it ...

Cheers,
Wol

On 22/04/2023 08:11, jfbu wrote:
I have not read all the details, but the pickled environment contains the full path to the project.

And at https://www.sphinx-doc.org/en/master/_modules/sphinx/environment.html you can find the lines

     def setup(self, app: Sphinx) -> None:
         """Set up BuildEnvironment object."""
        if self.version and self.version != app.registry.get_envversion(app):             raise BuildEnvironmentError(__('build environment version not current'))
         if self.srcdir and self.srcdir != app.srcdir:
            raise BuildEnvironmentError(__('source directory has changed'))

This BuildEnvironment.setup() is called from sphinx.application:
(see https://www.sphinx-doc.org/en/master/_modules/sphinx/application.html)

     def _load_existing_env(self, filename: str) -> BuildEnvironment:
         try:Facts
             with progress_message(__('loading pickled environment')):
                 with open(filename, 'rb') as f:
                     env = pickle.load(f)
                     env.setup(self)
                     self._fresh_env_used = False
         except Exception as err:
             logger.info(__('failed: %s'), err)
             env = self._create_fresh_env()
         return env

The environment "env" loaded from the pickled file carries the absolute path to the former location.  On the other hand the app.srcdir above contains the
absolute path to the new location.

Hence after doing "cp -a originalproject copiedproject" one gets
on next build attempt in new directory:

     loading pickled environment... failed
     failed: source directory has changed

Also other files under _build/doctrees such as index.doctree contain
absolute paths




--
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/0848f5da-a6ed-5ad2-f751-e1cdbecdbf70%40youngman.org.uk.

Reply via email to