Patchwork python-setuptools: Add missing $(TARGET_DIR) to PYTHONPATH.

login
register
mail settings
Submitter Markos Chandras
Date Aug. 22, 2013, 8:52 p.m.
Message ID <1377204777-8904-1-git-send-email-markos.chandras@imgtec.com>
Download mbox | patch
Permalink /patch/269193/
State Accepted
Headers show

Comments

Markos Chandras - Aug. 22, 2013, 8:52 p.m.
The $(TARGET_DIR) variable is required when building
python-setuptools for the target otherwise the build system detects
the host installation which leads to permission error problems
like these:

Setuptools installation detected at /usr/lib64/python2.7/site-packages
Renaming /usr/lib64/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info to
/usr/lib64/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info.OLD.1377005697.88
OSError: [Errno 13] Permission denied

Moreover, remove the PYTHONPATH variable for host variant since it's
not needed.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
 package/python-setuptools/python-setuptools.mk | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Arnout Vandecappelle - Aug. 22, 2013, 11:24 p.m.
On 22/08/13 22:52, Markos Chandras wrote:
> The $(TARGET_DIR) variable is required when building
> python-setuptools for the target otherwise the build system detects
> the host installation which leads to permission error problems
> like these:
>
> Setuptools installation detected at /usr/lib64/python2.7/site-packages
> Renaming /usr/lib64/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info to
> /usr/lib64/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info.OLD.1377005697.88
> OSError: [Errno 13] Permission denied
>
> Moreover, remove the PYTHONPATH variable for host variant since it's
> not needed.
>
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> ---
>   package/python-setuptools/python-setuptools.mk | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/package/python-setuptools/python-setuptools.mk b/package/python-setuptools/python-setuptools.mk
> index cd5ee4d..3044b4d 100644
> --- a/package/python-setuptools/python-setuptools.mk
> +++ b/package/python-setuptools/python-setuptools.mk
> @@ -20,19 +20,18 @@ endef
>
>   define PYTHON_SETUPTOOLS_BUILD_CMDS
>   	(cd $(@D); \
> -	PYTHONPATH="/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages" \
> +	PYTHONPATH="$(TARGET_DIR))/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages" \

  Double ) there...


  Regards,
  Arnout

>   	$(HOST_DIR)/usr/bin/python setup.py build)
>   endef
>
>   define HOST_PYTHON_SETUPTOOLS_INSTALL_CMDS
>   	(cd $(@D); \
> -	PYTHONPATH="$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages" \
>   	$(HOST_DIR)/usr/bin/python setup.py install --prefix=$(HOST_DIR)/usr)
>   endef
>
>   define PYTHON_SETUPTOOLS_INSTALL_TARGET_CMDS
>   	(cd $(@D); \
> -	PYTHONPATH="/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages" \
> +	PYTHONPATH="$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages" \
>   	$(HOST_DIR)/usr/bin/python setup.py install --executable=/usr/bin/python \
>   	--single-version-externally-managed --root=/ --prefix=$(TARGET_DIR)/usr)
>   endef
>
Markos Chandras - Aug. 22, 2013, 11:33 p.m.
On 23 August 2013 00:24, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 22/08/13 22:52, Markos Chandras wrote:
>>
>> The $(TARGET_DIR) variable is required when building
>> python-setuptools for the target otherwise the build system detects
>> the host installation which leads to permission error problems
>> like these:
>>
>> Setuptools installation detected at /usr/lib64/python2.7/site-packages
>> Renaming
>> /usr/lib64/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info to
>>
>> /usr/lib64/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info.OLD.1377005697.88
>> OSError: [Errno 13] Permission denied
>>
>> Moreover, remove the PYTHONPATH variable for host variant since it's
>> not needed.
>>
>> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
>> ---
>>   package/python-setuptools/python-setuptools.mk | 5 ++---
>>   1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/package/python-setuptools/python-setuptools.mk
>> b/package/python-setuptools/python-setuptools.mk
>> index cd5ee4d..3044b4d 100644
>> --- a/package/python-setuptools/python-setuptools.mk
>> +++ b/package/python-setuptools/python-setuptools.mk
>> @@ -20,19 +20,18 @@ endef
>>
>>   define PYTHON_SETUPTOOLS_BUILD_CMDS
>>         (cd $(@D); \
>> -       PYTHONPATH="/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages"
>> \
>> +
>> PYTHONPATH="$(TARGET_DIR))/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages"
>> \
>
>
>  Double ) there...
>

Sorry about that. I guess whoever commit this can fix it on the fly :)
Thomas Petazzoni - Aug. 23, 2013, 5:01 a.m.
Gustavo,

On Thu, 22 Aug 2013 21:52:57 +0100, Markos Chandras wrote:
> The $(TARGET_DIR) variable is required when building
> python-setuptools for the target otherwise the build system detects
> the host installation which leads to permission error problems
> like these:
> 
> Setuptools installation detected at /usr/lib64/python2.7/site-packages
> Renaming /usr/lib64/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info to
> /usr/lib64/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info.OLD.1377005697.88
> OSError: [Errno 13] Permission denied
> 
> Moreover, remove the PYTHONPATH variable for host variant since it's
> not needed.
> 
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Would you mind testing/acking this patch? You've been doing quite some
Python stuff, so I'd appreciate to have your input on this.

Thanks!

Thomas
Gustavo Zacarias - Aug. 23, 2013, 12:50 p.m.
On 08/23/2013 02:01 AM, Thomas Petazzoni wrote:

> Would you mind testing/acking this patch? You've been doing quite some
> Python stuff, so I'd appreciate to have your input on this.

Looks good in principle.
I'd like another thing fixed since for the target setuptools... purge
the damn windows executables :)
In the host that might not matter much, but for the target we're talking
~ 400 KiB extra nonsense (those cli*.exe and gui*.exe files that are
shipped).
The tests might be another candidate for removal at ~ 200 KiB.
Regards.
Gustavo Zacarias - Aug. 23, 2013, 12:50 p.m.
On 08/22/2013 05:52 PM, Markos Chandras wrote:

> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>

Tested-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Acked-by: Gustavo Zacarias <gustavo@zacarias.com.ar>

(After fixing the double parenthesis of course).
Markos Chandras - Aug. 23, 2013, 1:06 p.m.
Hi Gustavo,

On 23 August 2013 13:50, Gustavo Zacarias <gustavo@zacarias.com.ar> wrote:
> Looks good in principle.
> I'd like another thing fixed since for the target setuptools... purge
> the damn windows executables :)
> In the host that might not matter much, but for the target we're talking
> ~ 400 KiB extra nonsense (those cli*.exe and gui*.exe files that are
> shipped).
> The tests might be another candidate for removal at ~ 200 KiB.
> Regards.
>

In Gentoo we have the following patch:

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-python/setuptools/files/setuptools-0.6.45-no-exes.patch?revision=1.2&view=markup

I will test it against buildroot and submit it as a new patch soon.

Thanks for the review.
Gustavo Zacarias - Aug. 23, 2013, 1:08 p.m.
On 08/23/2013 10:06 AM, Markos Chandras wrote:
> In Gentoo we have the following patch:
> 
> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-python/setuptools/files/setuptools-0.6.45-no-exes.patch?revision=1.2&view=markup
> 
> I will test it against buildroot and submit it as a new patch soon.
> 
> Thanks for the review.

That or just add a post install target hook to remove them.
We usually prefer the later since we're poor and few and prefer to avoid
patches that might not apply for version bumps ;)
Regards.
Peter Korsgaard - Aug. 27, 2013, 8:33 p.m.
>>>>> "Markos" == Markos Chandras <markos.chandras@imgtec.com> writes:

 Markos> The $(TARGET_DIR) variable is required when building
 Markos> python-setuptools for the target otherwise the build system detects
 Markos> the host installation which leads to permission error problems
 Markos> like these:

 Markos> Setuptools installation detected at /usr/lib64/python2.7/site-packages
 Markos> Renaming /usr/lib64/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info to
 Markos> /usr/lib64/python2.7/site-packages/setuptools-0.9.8-py2.7.egg-info.OLD.1377005697.88
 Markos> OSError: [Errno 13] Permission denied

 Markos> Moreover, remove the PYTHONPATH variable for host variant since it's
 Markos> not needed.

Committed, thanks (with the double '))' fixed).

Patch

diff --git a/package/python-setuptools/python-setuptools.mk b/package/python-setuptools/python-setuptools.mk
index cd5ee4d..3044b4d 100644
--- a/package/python-setuptools/python-setuptools.mk
+++ b/package/python-setuptools/python-setuptools.mk
@@ -20,19 +20,18 @@  endef
 
 define PYTHON_SETUPTOOLS_BUILD_CMDS
 	(cd $(@D); \
-	PYTHONPATH="/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages" \
+	PYTHONPATH="$(TARGET_DIR))/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages" \
 	$(HOST_DIR)/usr/bin/python setup.py build)
 endef
 
 define HOST_PYTHON_SETUPTOOLS_INSTALL_CMDS
 	(cd $(@D); \
-	PYTHONPATH="$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages" \
 	$(HOST_DIR)/usr/bin/python setup.py install --prefix=$(HOST_DIR)/usr)
 endef
 
 define PYTHON_SETUPTOOLS_INSTALL_TARGET_CMDS
 	(cd $(@D); \
-	PYTHONPATH="/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages" \
+	PYTHONPATH="$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages" \
 	$(HOST_DIR)/usr/bin/python setup.py install --executable=/usr/bin/python \
 	--single-version-externally-managed --root=/ --prefix=$(TARGET_DIR)/usr)
 endef