Skip to contentSkip to conversation

set PYTHONPATH inside distutils-base.bbclass instead of distutils.bbclass

RFC Koen Kooi 2 participants 3 messages Feb 15, 2010

lore
Share & tools
lore

Koen Kooi

author
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I had a problem with building python-pygobject-native last week which was due to this bit in m4/python.m4

if test -x "$PYTHON-config"; then PYTHON_INCLUDES=$PYTHON-config --includes 2>/dev/null else PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" if test "$py_prefix" != "$py_exec_prefix"; then
PYTHON_INCLUDES="$PYTHON_INCLUDES
- -I${py_exec_prefix}/include/python${PYTHON_VERSION}"

Quoted 1 line

fi

fi

$PYTHON-config exists in staging and needs HOST_SYS, BUILDSYS, STAGING_LIBDIR and STAGING_INCDIR exported to work.

But after instrumenting python.m4 a bit I get this when running python-config:

Traceback (most recent call last):
File "/OE/angstrom-dev/staging/x86_64-linux/usr/bin/python-config",
line 26, in <module>
pyver = sysconfig.get_config_var('VERSION')
File "/usr/lib/python2.5/distutils/sysconfig.py", line 541, in
get_config_var
return get_config_vars().get(name)
File "/usr/lib/python2.5/distutils/sysconfig.py", line 499, in
get_config_vars

    func()

File "/usr/lib/python2.5/distutils/sysconfig.py", line 351, in _init_posix
filename = get_makefile_filename()
File "/usr/lib/python2.5/distutils/sysconfig.py", line 210, in
get_makefile_filename
return os.path.join(lib_dir, "config" + (sys.pydebug and "_d" or
""), "Makefile")AttributeError: 'module' object has no attribute 'pydebug'

Which means it's using the distutils on my buildhost instead of the proper one in staging.

OE is doing this:

export PYTHONPATH=/OE/bitbake:/OE/bitbake/lib:/OE/bitbake-git/bin:/usr/lib/python2.5:/usr/lib/python2.5/plat-linux2:/usr/lib/python2.5/lib-tk:/usr/lib/python2.5/lib-dynload:/usr/local/lib/python2.5/site-packages:/usr/lib/python2.5/site-packages:/usr/lib/python2.5/site-packages/Numeric:/usr/lib/python2.5/site-packages/PIL:/usr/lib/pymodules/python2.5:/usr/lib/pymodules/python2.5/gtk-2.0

So I added this to the recipe:

do_configure_prepend() {
unset PYTHONPATH
}

And everything started working again.

So my question is:

Can we set PYTHONPATH inside distutils-base.bbclass instead of distutils.bbclass or just plain unset it?

regards,

Koen

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFLeR5fMkyGM64RGpERApuWAJ4zzAKv7lVLPc9JIVJaBvul/ZGN2ACgmBH7 zA6ShA0i6mutv5+rCEncno8=
=48js
-----END PGP SIGNATURE-----

author
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

After some discussion with Richard I committed this:

http://cgit.openembedded.org/cgit.cgi/openembedded/commit/?id=fd4a161b6095f5b6f83d50d4d979000399944260

That seems to solve the sympoms I'm seeing, but the underlying problem is still present.

Quoted 54 lines · Koen Kooi

Hi,

I had a problem with building python-pygobject-native last week which was due to this bit in m4/python.m4

if test -x "$PYTHON-config"; then PYTHON_INCLUDES=$PYTHON-config --includes 2>/dev/null else PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" if test "$py_prefix" != "$py_exec_prefix"; then
PYTHON_INCLUDES="$PYTHON_INCLUDES
-I${py_exec_prefix}/include/python${PYTHON_VERSION}"

Quoted 1 line

fi

fi

$PYTHON-config exists in staging and needs HOST_SYS, BUILDSYS, STAGING_LIBDIR and STAGING_INCDIR exported to work.

But after instrumenting python.m4 a bit I get this when running python-config:

Traceback (most recent call last):
File "/OE/angstrom-dev/staging/x86_64-linux/usr/bin/python-config",
line 26, in <module>
pyver = sysconfig.get_config_var('VERSION')
File "/usr/lib/python2.5/distutils/sysconfig.py", line 541, in
get_config_var
return get_config_vars().get(name)
File "/usr/lib/python2.5/distutils/sysconfig.py", line 499, in
get_config_vars

    func()

File "/usr/lib/python2.5/distutils/sysconfig.py", line 351, in _init_posix
filename = get_makefile_filename()
File "/usr/lib/python2.5/distutils/sysconfig.py", line 210, in
get_makefile_filename
return os.path.join(lib_dir, "config" + (sys.pydebug and "_d" or
""), "Makefile")AttributeError: 'module' object has no attribute 'pydebug'

Which means it's using the distutils on my buildhost instead of the proper one in staging.

OE is doing this:

export PYTHONPATH=/OE/bitbake:/OE/bitbake/lib:/OE/bitbake-git/bin:/usr/lib/python2.5:/usr/lib/python2.5/plat-linux2:/usr/lib/python2.5/lib-tk:/usr/lib/python2.5/lib-dynload:/usr/local/lib/python2.5/site-packages:/usr/lib/python2.5/site-packages:/usr/lib/python2.5/site-packages/Numeric:/usr/lib/python2.5/site-packages/PIL:/usr/lib/pymodules/python2.5:/usr/lib/pymodules/python2.5/gtk-2.0

So I added this to the recipe:

do_configure_prepend() {
unset PYTHONPATH
}

And everything started working again.

Quoted 11 lines

So my question is:

Can we set PYTHONPATH inside distutils-base.bbclass instead of distutils.bbclass or just plain unset it?

regards,

Koen

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFLeVEUMkyGM64RGpERAkhlAJ9OiETWdhQeDNIjCmlxDiF2nwW4UQCfWLL6 02mZF8nFVpFFDJe7xvxHyHY=
=rfuo
-----END PGP SIGNATURE-----

#2 lore raw
Quoted 9 lines · Koen Kooi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

After some discussion with Richard I committed this:

http://cgit.openembedded.org/cgit.cgi/openembedded/commit/?id=fd4a161b6095f5b6f83d50d4d979000399944260

That seems to solve the sympoms I'm seeing, but the underlying problem is still present.

Thanks for working on this!

I had similar problem with python-gst, where it failed while do_configure in python-lib check
http://tinderbox.openembedded.net/packages/473005/
resolved in
http://git.openembedded.org/cgit.cgi/openembedded/commit/?id=f9f6c12d70b42ce6ec3461ea993ff52d10bfbc00
but clearly there is more python-related issues now.

I've seen similar issues all over tree when
switched from bitbake 1.8 to master. But haven't found the real issue, so didn't pushed my small hacks (probably wrong - seems like I got it built OK, because I pointed PYTHONPATH to wrong dir) used to compile whole image with bitbake master. (In attachement - but not for commit).

When I talked with Richard back then, he addmited that he has seen it too and then it got resolved automagically and that it's scary.

BTW: I had those before my last python/cython bump, so it shouldn't be related.

Regards,

Quoted 79 lines · Koen Kooi
Quoted 54 lines

Hi,

I had a problem with building python-pygobject-native last week which was due to this bit in m4/python.m4

if test -x "$PYTHON-config"; then PYTHON_INCLUDES=$PYTHON-config --includes 2>/dev/null else PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" if test "$py_prefix" != "$py_exec_prefix"; then
PYTHON_INCLUDES="$PYTHON_INCLUDES
-I${py_exec_prefix}/include/python${PYTHON_VERSION}"

Quoted 1 line

fi

fi

$PYTHON-config exists in staging and needs HOST_SYS, BUILDSYS, STAGING_LIBDIR and STAGING_INCDIR exported to work.

But after instrumenting python.m4 a bit I get this when running python-config:

Traceback (most recent call last):
File "/OE/angstrom-dev/staging/x86_64-linux/usr/bin/python-config",
line 26, in <module>
pyver = sysconfig.get_config_var('VERSION')
File "/usr/lib/python2.5/distutils/sysconfig.py", line 541, in
get_config_var
return get_config_vars().get(name)
File "/usr/lib/python2.5/distutils/sysconfig.py", line 499, in
get_config_vars

    func()

File "/usr/lib/python2.5/distutils/sysconfig.py", line 351, in _init_posix
filename = get_makefile_filename()
File "/usr/lib/python2.5/distutils/sysconfig.py", line 210, in
get_makefile_filename
return os.path.join(lib_dir, "config" + (sys.pydebug and "_d" or
""), "Makefile")AttributeError: 'module' object has no attribute 'pydebug'

Which means it's using the distutils on my buildhost instead of the proper one in staging.

OE is doing this:

export PYTHONPATH=/OE/bitbake:/OE/bitbake/lib:/OE/bitbake-git/bin:/usr/lib/python2.5:/usr/lib/python2.5/plat-linux2:/usr/lib/python2.5/lib-tk:/usr/lib/python2.5/lib-dynload:/usr/local/lib/python2.5/site-packages:/usr/lib/python2.5/site-packages:/usr/lib/python2.5/site-packages/Numeric:/usr/lib/python2.5/site-packages/PIL:/usr/lib/pymodules/python2.5:/usr/lib/pymodules/python2.5/gtk-2.0

So I added this to the recipe:

do_configure_prepend() {
unset PYTHONPATH
}

And everything started working again.

Quoted 11 lines

So my question is:

Can we set PYTHONPATH inside distutils-base.bbclass instead of distutils.bbclass or just plain unset it?

regards,

Koen

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFLeVEUMkyGM64RGpERAkhlAJ9OiETWdhQeDNIjCmlxDiF2nwW4UQCfWLL6 02mZF8nFVpFFDJe7xvxHyHY=
=rfuo
-----END PGP SIGNATURE-----

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

Signature · 3 lines
uin:136542059                jid:[email protected]
Jansa Martin                 sip:[email protected] 
JaMa                         

From 885c0da2dec4b56b4b02e8535e37271b4bcc42d6 Mon Sep 17 00:00:00 2001
From: Martin Jansa <[email protected]>
Date: Tue, 19 Jan 2010 13:04:37 +0100
Subject: [PATCH 06/16] distutils, python-cython-native: set PYTHONPATH before running python

---
 classes/distutils.bbclass                     |    4 +++-
 classes/package_ipk.bbclass                   |    1 +
 recipes/gpsd/gpsd.inc                         |    1 +
 recipes/gtk-webcore/midori.inc                |    2 ++
 recipes/python/python-cython-native_0.10.3.bb |    2 +-
 recipes/python/python-dbus_0.83.0.bb          |    1 +
 recipes/python/python-pygobject_2.20.0.bb     |    2 +-
 recipes/python/python-pyrex-native_0.9.8.5.bb |    1 +
 8 files changed, 11 insertions(+), 3 deletions(-)
classes/distutils.bbclass +3 -1
index 4d1fc8c..be35c1f 100644
@@ -11,6 +11,7 @@ distutils_do_compile() {
          STAGING_INCDIR=${STAGING_INCDIR} \
          STAGING_LIBDIR=${STAGING_LIBDIR} \
          BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
+         PYTHONPATH=${D}/${libdir}/${PYTHON_DIR}/site-packages \
          ${STAGING_BINDIR_NATIVE}/python setup.py build ${DISTUTILS_BUILD_ARGS} || \
          oefatal "python setup.py build_ext execution failed."
 }
@@ -18,6 +19,7 @@ distutils_do_compile() {
 distutils_stage_headers() {
         install -d ${STAGING_DIR_HOST}${libdir}/${PYTHON_DIR}/site-packages
         BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
+        PYTHONPATH=${D}/${libdir}/${PYTHON_DIR}/site-packages \
         ${STAGING_BINDIR_NATIVE}/python setup.py install_headers ${DISTUTILS_STAGE_HEADERS_ARGS} || \
         oefatal "python setup.py install_headers execution failed."
 }
@@ -26,7 +28,7 @@ distutils_stage_all() {
         STAGING_INCDIR=${STAGING_INCDIR} \
         STAGING_LIBDIR=${STAGING_LIBDIR} \
         install -d ${STAGING_DIR_HOST}${libdir}/${PYTHON_DIR}/site-packages
-        PYTHONPATH=${STAGING_DIR_HOST}${libdir}/${PYTHON_DIR}/site-packages \
+        PYTHONPATH=${D}/${libdir}/${PYTHON_DIR}/site-packages \
         BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
         ${STAGING_BINDIR_NATIVE}/python setup.py install ${DISTUTILS_STAGE_ALL_ARGS} || \
         oefatal "python setup.py install (stage) execution failed."
classes/package_ipk.bbclass +1 -0
index 420c892..9677b25 100644
@@ -78,6 +78,7 @@ do_package_update_index_ipk[depends] += "ipkg-utils-native:do_populate_staging"
 #
 do_package_update_index_ipk () {
 	set -x
+	PYTHONPATH=${STAGING_BINDIR} BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS}
 
 	ipkgarchs="${PACKAGE_ARCHS}"
 
recipes/gpsd/gpsd.inc +1 -0
index a917fbe..a3aacc9 100644
@@ -31,6 +31,7 @@ export STAGING_LIBDIR
 do_compile_prepend() {
     export BUILD_SYS="${BUILD_SYS}"
     export HOST_SYS="${HOST_SYS}"
+    export PYTHONPATH=${D}/${libdir}/${PYTHON_DIR}/site-packages
 	find ${S} -name "*.so" -exec rm -f {} \;
 }
 
recipes/gtk-webcore/midori.inc +2 -0
index fc2df36..b0fc452 100644
@@ -7,6 +7,8 @@ PE = "1"
 
 inherit autotools gtk-icon-cache pkgconfig
 
+export PYTHONPATH=${D}/${libdir}/${PYTHON_DIR}/site-packages
+
 SRC_URI = "http://software.twotoasts.de/media/midori/midori-${PV}.tar.gz"
 
 EXTRA_OECONF = "  --disable-hildon "
recipes/python/python-cython-native_0.10.3.bb +1 -1
index a5c78ce..95886ae 100644
@@ -4,7 +4,7 @@ DEPENDS = "python-native"
 RDEPENDS = ""
 
 do_stage() {
-    BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
+    PYTHONPATH=${STAGING_BINDIR} BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
     STAGING_LIBDIR=${STAGING_LIBDIR} STAGING_INCDIR=${STAGING_INCDIR} \
         ${STAGING_BINDIR}/python setup.py install --prefix=${STAGING_BINDIR}/.. --install-data=${STAGING_DATADIR}
 }
recipes/python/python-dbus_0.83.0.bb +1 -0
index 5d6f249..6c764e9 100644
@@ -12,6 +12,7 @@ inherit distutils-base autotools_stage pkgconfig
 
 export BUILD_SYS
 export HOST_SYS
+export PYTHONPATH=${D}/${libdir}/${PYTHON_DIR}/site-packages
 
 RDEPENDS_${PN} = "\
   python-io \
recipes/python/python-pygobject_2.20.0.bb +1 -1
index 10c94dc..11829fa 100644
@@ -19,7 +19,7 @@ inherit autotools distutils-base pkgconfig
 # necessary to let the call for python-config succeed
 export BUILD_SYS
 export HOST_SYS
-
+export PYTHONPATH=${D}/${libdir}/${PYTHON_DIR}/site-packages
 export GOBJECT_INTROSPECTION_CFLAGS="-pthread -I${STAGING_INCDIR}/gobject-introspection-1.0 -I${STAGING_INCDIR}/glib-2.0 -I${STAGING_LIBDIR}/glib-2.0/include"
 
 do_stage() {
recipes/python/python-pyrex-native_0.9.8.5.bb +1 -0
index 4405212..02b0685 100644
@@ -6,5 +6,6 @@ RDEPENDS = ""
 do_stage() {
 	BUILD_SYS=${BUILD_SYS} HOST_SYS=${HOST_SYS} \
 	STAGING_LIBDIR=${STAGING_LIBDIR} STAGING_INCDIR=${STAGING_INCDIR} \
+	PYTHONPATH=${D}/${libdir}/${PYTHON_DIR}/site-packages \
         ${STAGING_BINDIR}/python setup.py install --prefix=${STAGING_BINDIR}/.. --install-data=${STAGING_DATADIR}
 }
Signature · 1 line
1.6.6.1