Fix symbolic link handling in pelican-themes -s/-c
#3392
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
Description
Symlinks with relative paths were not handled properly by
pelican-themes
.Example:
The pelican theme to be installed is in a sibling directory to the project directory. Running
creates a symlink
../my-theme
in pelican’s theme folder. This link is broken, since the relative path in the symlink will now be resolved from pelican’s theme folder.When running
pelican-themes -c
from the project folder, it will not detect the broken symlink, since the relative path will actually resolve from the current directory (just not from pelican’s theme folder).This pull request fixes this by running
os.path.realpath
on the passed path both when creating symlinks and when checking symlinks. This will make sure that always the absolute paths are linked/checked.