Patchwork [47/58] setuptools: Make options for setup.py more flexible

login
register
mail settings
Submitter Saul Wold
Date April 16, 2011, 6:55 a.m.
Message ID <4f60a8f2b1b3f935ea029e6b780151015ea31c18.1302936483.git.sgw@linux.intel.com>
Download mbox | patch
Permalink /patch/2381/
State New, archived
Headers show

Comments

Saul Wold - April 16, 2011, 6:55 a.m.
From: Gary Thomas <gary@mlbassoc.com>

The setuptools class uses hard-wired options for 'setup.py' during
the install step.  In particular, not all versions of setup.py
support the "--single-version-externally-managed" option.  This
patch allows for a recipe to easily override these options, while
leaving the majority (important) setup options intact.

--
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

>From 0afbe6b9477c207e37009c8ef5aa47b3438640a9 Mon Sep 17 00:00:00 2001
From: Gary Thomas <gary@mlbassoc.com>
Date: Wed, 13 Apr 2011 15:12:57 -0600
Subject: [PATCH] setuptools: Make options for setup.py more flexible

Signed-off-by: Gary Thomas <gary@mlbassoc.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
---
 meta/classes/setuptools.bbclass |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Koen Kooi - April 16, 2011, 12:11 p.m.
As I said in my other mail, the reasoning behind this patch is wrong and will lead to broken output. The '--single-version-externally-managed' is needed to stop the python egg code from doing the wrong thing. People running into problems with this need to do 'inherit distutils' instead of 'inherit setuptools'.

Besides all that, 'DISTUTILS_INSTALL_EXTRA_ARGS' would be the correct name for such a thing.

Op 16 apr 2011, om 08:55 heeft Saul Wold het volgende geschreven:

> From: Gary Thomas <gary@mlbassoc.com>
> 
> The setuptools class uses hard-wired options for 'setup.py' during
> the install step.  In particular, not all versions of setup.py
> support the "--single-version-externally-managed" option.  This
> patch allows for a recipe to easily override these options, while
> leaving the majority (important) setup options intact.
> 
> --
> ------------------------------------------------------------
> Gary Thomas                 |  Consulting for the
> MLB Associates              |    Embedded world
> ------------------------------------------------------------
> 
>> From 0afbe6b9477c207e37009c8ef5aa47b3438640a9 Mon Sep 17 00:00:00 2001
> From: Gary Thomas <gary@mlbassoc.com>
> Date: Wed, 13 Apr 2011 15:12:57 -0600
> Subject: [PATCH] setuptools: Make options for setup.py more flexible
> 
> Signed-off-by: Gary Thomas <gary@mlbassoc.com>
> Signed-off-by: Saul Wold <sgw@linux.intel.com>
> ---
> meta/classes/setuptools.bbclass |    3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/meta/classes/setuptools.bbclass b/meta/classes/setuptools.bbclass
> index ced9509..cf1c224 100644
> --- a/meta/classes/setuptools.bbclass
> +++ b/meta/classes/setuptools.bbclass
> @@ -2,7 +2,8 @@ inherit distutils
> 
> DEPENDS += "python-setuptools-native"
> 
> +DISTUTILS_INSTALL_OPTS ?= "--single-version-externally-managed "
> DISTUTILS_INSTALL_ARGS = "--root=${D} \
> -    --single-version-externally-managed \
> +    ${DISTUTILS_INSTALL_OPTS} \
>     --prefix=${prefix} \
>     --install-data=${datadir}"
> -- 
> 1.7.1.1
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Koen Kooi - April 16, 2011, 7:46 p.m.
furthermore both distutils and setuptools use the classes in sysroot, so the 'some versions' part of the argument is bogus.

Op 16 apr. 2011 om 14:11 heeft Koen Kooi <koen@dominion.thruhere.net> het volgende geschreven:

> As I said in my other mail, the reasoning behind this patch is wrong and will lead to broken output. The '--single-version-externally-managed' is needed to stop the python egg code from doing the wrong thing. People running into problems with this need to do 'inherit distutils' instead of 'inherit setuptools'.
> 
> Besides all that, 'DISTUTILS_INSTALL_EXTRA_ARGS' would be the correct name for such a thing.
> 
> Op 16 apr 2011, om 08:55 heeft Saul Wold het volgende geschreven:
> 
>> From: Gary Thomas <gary@mlbassoc.com>
>> 
>> The setuptools class uses hard-wired options for 'setup.py' during
>> the install step.  In particular, not all versions of setup.py
>> support the "--single-version-externally-managed" option.  This
>> patch allows for a recipe to easily override these options, while
>> leaving the majority (important) setup options intact.
>> 
>> --
>> ------------------------------------------------------------
>> Gary Thomas                 |  Consulting for the
>> MLB Associates              |    Embedded world
>> ------------------------------------------------------------
>> 
>>> From 0afbe6b9477c207e37009c8ef5aa47b3438640a9 Mon Sep 17 00:00:00 2001
>> From: Gary Thomas <gary@mlbassoc.com>
>> Date: Wed, 13 Apr 2011 15:12:57 -0600
>> Subject: [PATCH] setuptools: Make options for setup.py more flexible
>> 
>> Signed-off-by: Gary Thomas <gary@mlbassoc.com>
>> Signed-off-by: Saul Wold <sgw@linux.intel.com>
>> ---
>> meta/classes/setuptools.bbclass |    3 ++-
>> 1 files changed, 2 insertions(+), 1 deletions(-)
>> 
>> diff --git a/meta/classes/setuptools.bbclass b/meta/classes/setuptools.bbclass
>> index ced9509..cf1c224 100644
>> --- a/meta/classes/setuptools.bbclass
>> +++ b/meta/classes/setuptools.bbclass
>> @@ -2,7 +2,8 @@ inherit distutils
>> 
>> DEPENDS += "python-setuptools-native"
>> 
>> +DISTUTILS_INSTALL_OPTS ?= "--single-version-externally-managed "
>> DISTUTILS_INSTALL_ARGS = "--root=${D} \
>> -    --single-version-externally-managed \
>> +    ${DISTUTILS_INSTALL_OPTS} \
>>    --prefix=${prefix} \
>>    --install-data=${datadir}"
>> -- 
>> 1.7.1.1
>> 
>> 
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
Saul Wold - April 16, 2011, 9:43 p.m.
On 04/16/2011 12:46 PM, Koen Kooi wrote:
> furthermore both distutils and setuptools use the classes in sysroot, so the 'some versions' part of the argument is bogus.
>
Koen,

Thanks, I guess missed your comments on this issue, thanks for pointing 
them out.

Richard: Please disregard this patch.

Sau!

> Op 16 apr. 2011 om 14:11 heeft Koen Kooi<koen@dominion.thruhere.net>  het volgende geschreven:
>
>> As I said in my other mail, the reasoning behind this patch is wrong and will lead to broken output. The '--single-version-externally-managed' is needed to stop the python egg code from doing the wrong thing. People running into problems with this need to do 'inherit distutils' instead of 'inherit setuptools'.
>>
>> Besides all that, 'DISTUTILS_INSTALL_EXTRA_ARGS' would be the correct name for such a thing.
>>
>> Op 16 apr 2011, om 08:55 heeft Saul Wold het volgende geschreven:
>>
>>> From: Gary Thomas<gary@mlbassoc.com>
>>>
>>> The setuptools class uses hard-wired options for 'setup.py' during
>>> the install step.  In particular, not all versions of setup.py
>>> support the "--single-version-externally-managed" option.  This
>>> patch allows for a recipe to easily override these options, while
>>> leaving the majority (important) setup options intact.
>>>
>>> --
>>> ------------------------------------------------------------
>>> Gary Thomas                 |  Consulting for the
>>> MLB Associates              |    Embedded world
>>> ------------------------------------------------------------
>>>
>>>>  From 0afbe6b9477c207e37009c8ef5aa47b3438640a9 Mon Sep 17 00:00:00 2001
>>> From: Gary Thomas<gary@mlbassoc.com>
>>> Date: Wed, 13 Apr 2011 15:12:57 -0600
>>> Subject: [PATCH] setuptools: Make options for setup.py more flexible
>>>
>>> Signed-off-by: Gary Thomas<gary@mlbassoc.com>
>>> Signed-off-by: Saul Wold<sgw@linux.intel.com>
>>> ---
>>> meta/classes/setuptools.bbclass |    3 ++-
>>> 1 files changed, 2 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/meta/classes/setuptools.bbclass b/meta/classes/setuptools.bbclass
>>> index ced9509..cf1c224 100644
>>> --- a/meta/classes/setuptools.bbclass
>>> +++ b/meta/classes/setuptools.bbclass
>>> @@ -2,7 +2,8 @@ inherit distutils
>>>
>>> DEPENDS += "python-setuptools-native"
>>>
>>> +DISTUTILS_INSTALL_OPTS ?= "--single-version-externally-managed "
>>> DISTUTILS_INSTALL_ARGS = "--root=${D} \
>>> -    --single-version-externally-managed \
>>> +    ${DISTUTILS_INSTALL_OPTS} \
>>>     --prefix=${prefix} \
>>>     --install-data=${datadir}"
>>> --
>>> 1.7.1.1
>>>
>>>
>>> _______________________________________________
>>> Openembedded-core mailing list
>>> Openembedded-core@lists.openembedded.org
>>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Gary Thomas - April 17, 2011, 1:26 p.m.
On 04/16/2011 03:43 PM, Saul Wold wrote:
> On 04/16/2011 12:46 PM, Koen Kooi wrote:
>> furthermore both distutils and setuptools use the classes in sysroot, so the 'some versions' part of the argument is bogus.
>>
> Koen,
>
> Thanks, I guess missed your comments on this issue, thanks for pointing them out.
>
> Richard: Please disregard this patch.

Fair enough & indeed, using distutils does work for this package.  My follow up question would
be why are there two seemingly identical classes?  Just looking at a Python package which has
a 'setup.py' file, how can one one which to use and why??

>> Op 16 apr. 2011 om 14:11 heeft Koen Kooi<koen@dominion.thruhere.net> het volgende geschreven:
>>
>>> As I said in my other mail, the reasoning behind this patch is wrong and will lead to broken output. The '--single-version-externally-managed' is needed to stop the python egg
>>> code from doing the wrong thing. People running into problems with this need to do 'inherit distutils' instead of 'inherit setuptools'.
>>>
>>> Besides all that, 'DISTUTILS_INSTALL_EXTRA_ARGS' would be the correct name for such a thing.
>>>
>>> Op 16 apr 2011, om 08:55 heeft Saul Wold het volgende geschreven:
>>>
>>>> From: Gary Thomas<gary@mlbassoc.com>
>>>>
>>>> The setuptools class uses hard-wired options for 'setup.py' during
>>>> the install step. In particular, not all versions of setup.py
>>>> support the "--single-version-externally-managed" option. This
>>>> patch allows for a recipe to easily override these options, while
>>>> leaving the majority (important) setup options intact.
>>>>
>>>> --
>>>> ------------------------------------------------------------
>>>> Gary Thomas | Consulting for the
>>>> MLB Associates | Embedded world
>>>> ------------------------------------------------------------
>>>>
>>>>> From 0afbe6b9477c207e37009c8ef5aa47b3438640a9 Mon Sep 17 00:00:00 2001
>>>> From: Gary Thomas<gary@mlbassoc.com>
>>>> Date: Wed, 13 Apr 2011 15:12:57 -0600
>>>> Subject: [PATCH] setuptools: Make options for setup.py more flexible
>>>>
>>>> Signed-off-by: Gary Thomas<gary@mlbassoc.com>
>>>> Signed-off-by: Saul Wold<sgw@linux.intel.com>
>>>> ---
>>>> meta/classes/setuptools.bbclass | 3 ++-
>>>> 1 files changed, 2 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/meta/classes/setuptools.bbclass b/meta/classes/setuptools.bbclass
>>>> index ced9509..cf1c224 100644
>>>> --- a/meta/classes/setuptools.bbclass
>>>> +++ b/meta/classes/setuptools.bbclass
>>>> @@ -2,7 +2,8 @@ inherit distutils
>>>>
>>>> DEPENDS += "python-setuptools-native"
>>>>
>>>> +DISTUTILS_INSTALL_OPTS ?= "--single-version-externally-managed "
>>>> DISTUTILS_INSTALL_ARGS = "--root=${D} \
>>>> - --single-version-externally-managed \
>>>> + ${DISTUTILS_INSTALL_OPTS} \
>>>> --prefix=${prefix} \
>>>> --install-data=${datadir}"
>>>> --
>>>> 1.7.1.1
>>>>
>>>>
>>>> _______________________________________________
>>>> Openembedded-core mailing list
>>>> Openembedded-core@lists.openembedded.org
>>>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>>>
>>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Koen Kooi - April 17, 2011, 5:02 p.m.
Op 17 apr 2011, om 15:26 heeft Gary Thomas het volgende geschreven:

> On 04/16/2011 03:43 PM, Saul Wold wrote:
>> On 04/16/2011 12:46 PM, Koen Kooi wrote:
>>> furthermore both distutils and setuptools use the classes in sysroot, so the 'some versions' part of the argument is bogus.
>>> 
>> Koen,
>> 
>> Thanks, I guess missed your comments on this issue, thanks for pointing them out.
>> 
>> Richard: Please disregard this patch.
> 
> Fair enough & indeed, using distutils does work for this package.  My follow up question would
> be why are there two seemingly identical classes?

Because python people suck at agreeing on buildsystems.

>  Just looking at a Python package which has
> a 'setup.py' file, how can one one which to use and why??

That is an excellent questions! I sadly have no good answer to that :( Figuring out the problem your patch was trying to solve took me about 3 weeks. I started using it as a smoke test to see if it's setuptools or not. Usually you can get away with using distutils everywhere, but sometimes you really need setuptools. My workflow:

try setuptools, if that fails:
try distutils, if that fails:
tell people to stop using that python module

regards,

Koen

Patch

diff --git a/meta/classes/setuptools.bbclass b/meta/classes/setuptools.bbclass
index ced9509..cf1c224 100644
--- a/meta/classes/setuptools.bbclass
+++ b/meta/classes/setuptools.bbclass
@@ -2,7 +2,8 @@  inherit distutils
 
 DEPENDS += "python-setuptools-native"
 
+DISTUTILS_INSTALL_OPTS ?= "--single-version-externally-managed "
 DISTUTILS_INSTALL_ARGS = "--root=${D} \
-    --single-version-externally-managed \
+    ${DISTUTILS_INSTALL_OPTS} \
     --prefix=${prefix} \
     --install-data=${datadir}"