-
-
Notifications
You must be signed in to change notification settings - Fork 632
Redirect stdout when checking imports. #1007
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
Redirect stdout when checking imports. #1007
Conversation
return "" | ||
|
||
|
||
site.getusersitepackages = __override_getusersitepackages__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code wasn't having the desired effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting.
Fixes bazel-contrib#1006 Also, set PYTHONNOUSERSITE so that the script doesn't even look in site packages when checking modules. Fix typo with capitilize.
cf8c3cb
to
f7e1e31
Compare
I might be able to add a test case |
Scratch that, looks a bit more involved. Probably enough of an edge case here that it doesn't really need to be covered by a test. |
for module in stdin: | ||
module = module.strip() | ||
# Don't print the boolean directly as it is captilized in Python. | ||
# Don't print the boolean directly as it is capitalized in Python. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the Brazilian spelling. 🤣
Thanks for fixing it.
return "" | ||
|
||
|
||
site.getusersitepackages = __override_getusersitepackages__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting.
Fixes #1006
Also, set PYTHONNOUSERSITE so that the script doesn't even look in site packages when checking modules.
Fix typo with capitilize.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #1006
What is the new behavior?
No extraneous output.
Does this PR introduce a breaking change?
Other information