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
docbuild: Use lexists when testing whether a symlink exists #22438
Comments
This comment has been minimized.
This comment has been minimized.
New commits:
|
Author: Ximin Luo |
Commit: |
comment:3
This looks annoying. Why the symlink is pointing to a non-existing directory in the first place? |
comment:4
I can't remember now. Possibly I was messing around with a solution to #21732 or #22088 or just getting the Debian package working in the first place. But the logic shouldn't break just because I might've been doing unusual things. There's already logic to remove a regular file or a working symlink to a file, so we should also remove broken symlinks. |
comment:5
Instead of trying to figure out whether to run
PS: I sometimes wonder why Python makes it so hard to implement common shell commands like |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:8
I tweaked what you suggested to be a bit shorter. It's not fully EAFP but I think the brevity makes up for it. Interestingly on Python3 they have a special subclass of OSError called IsADirectoryError that would make this code even shorter, but never mind. |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:11
whoops, I forgot to re-raise for other types of errors. ¬.¬ |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:13
I realised the previous version (in comment:10) is wrong, here is an updated version. If you don't like it, I can also do the longer EAFP version that you posted earlier. I actually think the first one (my original commit) is best, it's slightly long-winded but at least the error messages are exact. With both this recent version and your EAFP version, the error messages could be misleading, e.g. Recent version:
EAFP version:
|
Reviewer: Jeroen Demeyer |
Changed branch from u/infinity0/docbuild__use_lexists_when_testing_whether_a_symlink_exists to |
Otherwise the build fails if the symlink is already there but points to a non-existing path.
Component: build
Author: Ximin Luo
Branch/Commit:
05ee235
Reviewer: Jeroen Demeyer
Issue created by migration from https://trac.sagemath.org/ticket/22438
The text was updated successfully, but these errors were encountered: