Fallback to user's log path if default log path is not writable #870
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.
docs/changelog.md
Summary of changes
This PR changes the logging setup so that it fallbacks to user's log path (as defined by
platformdirs.user_log_path("pipx")
) if the default log path ($PIPX_HOME/logs
) is not writable which may occur when using pipx for install applications system-wide (per the documentation here: https://pypa.github.io/pipx/installation/#installation-options). This allows the user to use commands such aspipx list
to list system-wide applications without having access to$PIPX_HOME
.This was suggested in #754 (comment)
While working on this, I had a few thoughts/questions:
constants.PIPX_LOG_DIR
be altered or actually remain a constant as the module name advertises (note thatconstants.pipx_log_dir
is going to be altered anyway)platformdirs
here:$DEFAULT_PIPX_HOME/logs
insteadThere's a single test failure on
jaraco-financial
that is unrelated to this PR:`jaraco-financial` failure
Test plan
Tested by running