-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
pip: combine chdir and env only when env is set #40793
Conversation
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.
LGTM
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.
@robinro thank you for the pointers. The fix here is complete for the error that is reported here. There seem to be other issues with the pip module discussed in #40129 that can be addressed with extra changes, but the Therefore it would be great to merge at least this fix and then continue the discussion about the other problems. |
45a8969
to
6384c9f
Compare
@robinro I added an integration test |
The test
The test
|
@tyll Thanks for the test. To me it's a bit over-the-top and also the CI complains. I wouldn't use a custom package for this. |
On Thu, Jun 21, 2018 at 11:50:23AM -0700, Robin Roth wrote:
@tyll Thanks for the test. To me it's a bit over-the-top and also the CI complains. I wouldn't use a custom package for this.
Maybe we can have a test that "only" checks for the original issue: Not failing when `chdir` and `env` are both passed. Maybe use a relative path to a trivial requirements.txt to check if the chdir has effect, but even that is imo not necessary.
This is a test for the use case I have, therefore it would be great if
it could be tested. The CI results are outdated AFAICS, I addressed them
back then, I believe. The original issue happens when only chdir is set
but env is not and this seems to make only sense when running "pip
install ." but I might be missing something.
|
The test
|
da6e1cd
to
06c9d04
Compare
@mattclay The failure on OS X should be fixed now, Shippable seems to take some time, so we will know later. |
This fixes an AttributeError when chdir without virtualenv is specified: File "/tmp/ansible_2UAFsZ/ansible_module_pip.py", line 387, in main env = os.path.join(chdir, env) File "/usr/lib64/python2.7/posixpath.py", line 75, in join if b.startswith('/'): AttributeError: 'NoneType' object has no attribute 'startswith'
Signed-off-by: Till Maas <opensource@till.name>
shipit |
bot_status |
Componentslib/ansible/modules/packaging/language/pip.py test/integration/targets/pip/files/ansible_test_pip_chdir/init.py test/integration/targets/pip/files/setup.py test/integration/targets/pip/tasks/pip.yml Metadatawaiting_on: ansible |
shipit |
any chance of getting this merged? |
Will this fix only be avaiable in 2.7, or is there any chance of it being back ported to 2.5 or 2.6? |
it is in 2.7 |
SUMMARY
This fixes an AttributeError when chdir without virtualenv is specified:
File "/tmp/ansible_2UAFsZ/ansible_module_pip.py", line 387, in main
env = os.path.join(chdir, env)
File "/usr/lib64/python2.7/posixpath.py", line 75, in join
if b.startswith('/'):
AttributeError: 'NoneType' object has no attribute 'startswith'
ISSUE TYPE
COMPONENT NAME
pip
ANSIBLE VERSION
ADDITIONAL INFORMATION