Skip to content
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

Symlink to index.html #720

Closed
buhtz opened this issue Jun 15, 2023 · 10 comments · Fixed by #809
Closed

Symlink to index.html #720

buhtz opened this issue Jun 15, 2023 · 10 comments · Fixed by #809

Comments

@buhtz
Copy link
Contributor

buhtz commented Jun 15, 2023

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.

@tristanlatr
Copy link
Contributor

I agree. It also confuses readthedocs (#696).

@tristanlatr
Copy link
Contributor

Would you like to send a PR to fix it, @buhtz ?

@buhtz
Copy link
Contributor Author

buhtz commented Jun 15, 2023

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.

@tristanlatr
Copy link
Contributor

A hardlink will be ok I suppose.

@tristanlatr
Copy link
Contributor

So using os.link()

@jgarbers
Copy 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'

@tristanlatr
Copy link
Contributor

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.

@tristanlatr
Copy link
Contributor

tristanlatr commented Oct 1, 2023

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.

@buhtz
Copy link
Contributor Author

buhtz commented Dec 26, 2023

I can also confirm the problem on Windows with missing user privileges.

@tristanlatr
Copy link
Contributor

tristanlatr commented May 1, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants