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

Ignore inaccessible user config #2158

Merged
merged 5 commits into from Apr 27, 2021
Merged

Ignore inaccessible user config #2158

merged 5 commits into from Apr 27, 2021

Conversation

JelleZijlstra
Copy link
Collaborator

Fixes #2157

@Spacetown
Copy link

@JelleZijlstra How can I use this in my requirements.txt? I've only usedversions yet.

Copy link
Collaborator

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, lets just not be silent about it to save peoples time potentially ...

else None
)
except PermissionError:
# We do not have access to the user-level config directory, so ignore it.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add some logging (atleast @ debug level) so we at least tell the user why their config is not being picked up.

  • Could save hours of debugging for someone one day
  • Silent swallowing at debug level is evil

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I made it just unconditionally print for now. Maybe we'd want to do it only if -v is passed, but that's hard because this code gets executed during argument parsing.

@JelleZijlstra
Copy link
Collaborator Author

@Spacetown for quick testing I'd just manually edit the file (/usr/local/lib/python3.6/dist-packages/black/__init__.py in your case, based on the stack trace in the issue). Beyond that, you can install something from git directly (documented at https://pip.pypa.io/en/stable/cli/pip_install/#git), or you can wait for us to release the fix.

It's up to @cooperlees but I think we might want to do another release to get this fix out, since the bug seems to make Black completely unusable for use cases like yours.

@cooperlees
Copy link
Collaborator

I feel this is a super low risk bug fix and releases are easy now.

Let's wait till tomorrow morning pacific time and I'll evaluate cutting another release.

@JelleZijlstra
Copy link
Collaborator Author

Yes, we can also wait for other issues to come in.

Spacetown added a commit to Spacetown/gcovr that referenced this pull request Apr 27, 2021
@Spacetown
Copy link

@JelleZijlstra On my machine it's working. The result is also available here https://github.com/Spacetown/gcovr/runs/2451934895?check_suite_focus=true.

python3 -m black --diff doc gcovr
Running chmod with sudoIgnoring user configuration directory due to PermissionError(13, 'Permission denied')

@JelleZijlstra
Copy link
Collaborator Author

Thanks @Spacetown! Looks like a missing newline in the output but I think the first message isn't from Black, so that needs to be fixed elsewhere.

@JelleZijlstra JelleZijlstra merged commit ad16964 into master Apr 27, 2021
@JelleZijlstra JelleZijlstra deleted the slash branch April 27, 2021 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception raised if installed under root.
3 participants