Skip to contentSkip to conversation

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

PATCH New Markos Chandras 6 participants 9 messages Aug 22, 2013 – Aug 27, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 python-setuptools: Add missing $(TARGET_DIR) to PYTHONPATH.

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.

---
 package/python-setuptools/python-setuptools.mk | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
package/python-setuptools/python-setuptools.mk +2 -3
index cd5ee4d..3044b4d 100644
@@ -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
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 python-setuptools: Add missing $(TARGET_DIR) to PYTHONPATH.

Quoted 23 lines · Markos Chandras

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.

---
  package/python-setuptools/python-setuptools.mk | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
package/python-setuptools/python-setuptools.mk +0 -0
index cd5ee4d..3044b4d 100644

package/python-setuptools/python-setuptools.mk endef · line 23

Quoted 5 lines
package/python-setuptools/python-setuptools.mk +1 -1
@@ -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

Quoted 17 lines
package/python-setuptools/python-setuptools.mk +1 -2
  	$(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
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

PATCH 1/1 python-setuptools: Add missing $(TARGET_DIR) to PYTHONPATH.

Quoted 29 lines · Arnout Vandecappelle
Quoted 28 lines · Markos Chandras

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.

---
  package/python-setuptools/python-setuptools.mk | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
package/python-setuptools/python-setuptools.mk +0 -0
index cd5ee4d..3044b4d 100644
@@ -20,19 +20,18 @@ endef
 
Quoted 11 lines
Quoted 7 lines
package/python-setuptools/python-setuptools.mk +1 -1
  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 :)

Signature · 2 lines
Regards,
Markos Chandras
#3 lore raw

PATCH 1/1 python-setuptools: Add missing $(TARGET_DIR) to PYTHONPATH.

In reply to Markos Chandras

Gustavo,

Quoted 10 lines · Markos Chandras

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

Quoted 4 lines

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

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

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw

PATCH 1/1 python-setuptools: Add missing $(TARGET_DIR) to PYTHONPATH.

Quoted 2 lines · Thomas Petazzoni

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.

#5 lore raw

PATCH 1/1 python-setuptools: Add missing $(TARGET_DIR) to PYTHONPATH.

Hi Gustavo,

Quoted 9 lines · Gustavo Zacarias

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.

Signature · 2 lines
Regards,
Markos Chandras
#6 lore raw

PATCH 1/1 python-setuptools: Add missing $(TARGET_DIR) to PYTHONPATH.

Quoted 7 lines · Markos Chandras

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.

#8 lore raw

PATCH 1/1 python-setuptools: Add missing $(TARGET_DIR) to PYTHONPATH.

In reply to Markos Chandras
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markos" == Markos Chandras <[email protected]> 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).

Signature · 1 line
Bye, Peter Korsgaard