Skip to content

Conversation

@FazeelUsmani
Copy link

This PR fixes a regression introduced in v8.2.0 where an empty _sources/ directory is created during HTML builds even when html_copy_source = False is explicitly set in conf.py.

The Bug:
The prepare_writing() method in StandaloneHTMLBuilder was checking self.copysource (a class attribute that always defaults to True) instead of self.config.html_copy_source (the actual user configuration value).

The Fix:
Changed the condition on line 574 of sphinx/builders/html/__init__.py from:

if self.copysource:
to:
if self.config.html_copy_source:

Testing:

  • Verified the fix resolves the issue with manual reproduction steps
  • All existing tests pass, including test_html_copy_source
  • Confirmed both scenarios work correctly:
    • html_copy_source = False: No _sources directory created ✓
    • html_copy_source = True: _sources directory created with source files ✓

This is important for users packaging documentation (e.g., Debian packages) who should not have to manually clean up empty directories that shouldn't exist.

References

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.

Empty _sources directory created even with html_copy_source disabled

1 participant