[openstack-dev] [pbr] support for 'python setup.py install'

Monty Taylor mordred at inaugust.com
Sat Apr 25 16:17:24 UTC 2015


On 04/25/2015 11:46 AM, Monty Taylor wrote:
> On 04/25/2015 11:33 AM, Dave Walker wrote:
>> I'm not going to pretend it is graceful... but is there a situation
>> where _" isn't correct?
> 
> Ooh. This is a worthy avenue to explore ...

Ok. After some chatting with fungi in IRC - I've got this:

https://review.openstack.org/177557

It finds direct invocations and fails. It works with pip - and it
handles distro-packaging invocation paths appropriately.

It also gives a very lengthy error message that makes it clear what a
user should do.

>> $ cat setup.py
>> #!/usr/bin/env python
>>
>> from distutils.core import setup as _setup
>> import os
>>
>> def new_setup(**attrs):
>>         if "pip" not in os.environ.get("_"):
>>             raise SystemExit("Please use pip to install")
>>         else:
>>             _setup(**attrs)
>>
>> setup = new_setup
>>
>> setup(name='foobar',
>>       version='1.0',
>>       description='Foobar',
>>      )
>>
>>
>> --
>> Kind Regards,
>> Dave Walker
>>
>>
>> On 25 April 2015 at 15:27, Monty Taylor <mordred at inaugust.com> wrote:
>>> On 04/25/2015 09:49 AM, Jeremy Stanley wrote:
>>>> On 2015-04-25 12:12:15 +1200 (+1200), Robert Collins wrote:
>>>> [...]
>>>>> I'd like to make that a little more official:
>>>>>  - put it in our docs
>>>>>  - stop testing python setup.py install.
>>>> [...]
>>>>
>>>> And emit a clear error message? (Even if that just means updating the
>>>> setup.py boilerplate in the cookiecutter repo and encouraging
>>>> projects to adopt the function.)
>>>>
>>>
>>> Unfortunately there is no way to detect that you're being run via
>>> setup.py install instead of pip. What will happen though is that
>>> easy_install will get triggered  instead of egg_info/pip install ... so
>>> we _could_ just do something to try to emit a warning around one of the
>>> easy_install classes ...
>>>
>>> __________________________________________________________________________
>>> OpenStack Development Mailing List (not for usage questions)
>>> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>> __________________________________________________________________________
>> OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
> 
> 
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 




More information about the OpenStack-dev mailing list