Open buhtz opened 1 year ago
I agree. It also confuses readthedocs (#696).
Would you like to send a PR to fix it, @buhtz ?
Would you like to send a PR to fix it, @buhtz ?
I can try. But it will take time. Please tell me if you like a hardlink or a redirecting html file.
A hardlink will be ok I suppose.
So using os.link()
I've been trying to build my docs on Windows, and creating the symlink also seems to require elevated privileges, since I get this error unless I run pydoctor as Administrator:
File "C:\Users\jgarbers3\AppData\Local\Programs\Python\Python311\Lib\pathlib.py", line 1198, in symlink_to
os.symlink(target, self, target_is_directory)
OSError: [WinError 1314] A required privilege is not held by the client: 'index.html' -> 'C:\\Users\\jgarbers3\\lab\\ev\\docs\\build\\html\\api\\ev.html'
Thanks for the report, @jgarbers. You can try to fix the PR #722 if you want, I haven't allocated time to look at it yet.
What about doing something like this: https://superuser.com/questions/560597/convert-symlinks-to-hard-links ? But in python, if a specific option is given, like --use-hard-links or something.
I can also confirm the problem on Windows with missing user privileges.
I believe a solution would be to build a mapping of links during the html writing. And after create those links with the appropriate strategy: either symbolic or hard links. This will be helpful as well for futures développements because we might have to create a lot of links to ensure no 404 are generated for a page name that correspond to a python module or class (because they might be moved during reparenting). See #739
It seems that pydoctor do create a a symlink (named with the package name) to
index.html
.~I couldn't find the right place in code where this happens.~ I think it happens here.
I'm asking to modify this somehow. Maybe it could be a hard link instead of a symlink. Or it could be a regular html file with a redirect directive in it.
Symlinks do often confuse other software, e.g. nextCloud/ownCloud, some Backup software etc.
I can't think of a reason why it couldn't be a hardlink.