- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Create unique directories, not unique filenames in _downloads #2720
Comments
I think only HTMLBuilder needs this hack. epub/qthelp don't allow download role. Maybe applehelp/htmlhelp don't support too. |
This is still a problem, but I am seeing some strange interaction with images. An image which is linked to several times will have the second link show up as "_images/subdir1/image.png", but the image is located in "_images/image.png" and the first ".. image::" directive shows the correct link. These are obviously the same image, so they should not be treated as different with duplicate names. I will take a look to see if I can figure out what is going on. If I fix this, would a pull request be appreciated? Having this large hack in conf.py for an extended amount of time is not great |
The following fixed this, but it probably only works on stable, not master due to self.app.status_iterator vs status_iterator # Hack to support sub-directories within the _images directory
def copy_image_files(self):
# type: () -> None
# copy image files
if self.images:
ensuredir(path.join(self.outdir, self.imagedir))
for src in self.app.status_iterator(self.images, 'copying images... ',
brown, len(self.images)):
dest = self.images[src]
subdirs, filename = os.path.split(dest)
if subdirs:
ensuredir(path.join(self.outdir, self.imagedir, subdirs))
try:
copyfile(path.join(self.srcdir, src),
path.join(self.outdir, self.imagedir, dest))
except Exception as err:
logger.warning('cannot copy image file %r: %s', path.join(self.srcdir, src), err)
StandaloneHTMLBuilder.copy_image_files = copy_image_files Do you want a pull request? |
Thank you. Yes, we want to PR. But for master branch. Your code affects current behavior. So it should be in 1.6. A potential issue is a link URL for the file would be changed. If any other websites link to the file directly, it becomes 404. So could you rewrite your code based on master branch and put a comment to "Incompatible changes" section in CHANGES file? |
All tests pass on my machine except one, "test_texinfo" in the file "test_build_textinfo.py", which gives error on a line of the generated SphinxTests.texti containing:: @enumerate 24 The error is:: SphinxTests.texi:2141: bad argument to @enumerate I do not know anything about texinfo, but I guess/hope this is unrelated and may be due to the version of makeinfo on my machine?
All tests pass on my machine except one, "test_texinfo" in the file "test_build_textinfo.py", which gives error on a line of the generated SphinxTests.texti containing: @enumerate 24 The error is: SphinxTests.texi:2141: bad argument to @enumerate I do not know anything about texinfo, but I guess/hope this is unrelated and may be due to the version of makeinfo on my machine?
Pull request created. Now, lets see what travis thinks about it ... |
Is there anything else I should do about this now, or will it be included in the next release? I believe I have answered/fixed all concerns |
…, duplicate names, and parallel builds
…d:``, duplicate names, and parallel builds
…d:``, duplicate names, and parallel builds
…d:``, duplicate names, and parallel builds
Fixed by #5377. |
We have a similar problem as bug #823 with files such as CMakeLists.txt and Makefile. The reader will get confused when we tell them to download a demo file along with a CMakeLists.txt file and then they get CMakeLists5.txt which is not recognized by the cmake program, so they must remember to rename the file before running the demo.
We do not require as large a change as #823 (which is why I created a new issue), only that the file base names remain unchanged and unique prefix directories are created. A quick and ugly fix is stick this at the end of conf.py, but hotpatching internal Sphinx APIs is not very maintainable in the long run ...
This works-for-me! Would something similar be appreciated as a patch? I guess more builders would need to be changed?
The text was updated successfully, but these errors were encountered: