[OE-core] [PATCH 1/2] easyinstall: class to create and extend the easyinstall.pth file

Otavio Salvador otavio at ossystems.com.br
Tue Dec 18 14:27:30 UTC 2012


On Tue, Dec 18, 2012 at 11:58 AM, Lukas Bulwahn
<lukas.bulwahn at oss.bmw-carit.de> wrote:
> From: Lukas Bulwahn <lukas.bulwahn at bmw-carit.de>
>
> When installing python packages that are installed with python's easyinstall,
> the installation creates easyinstall.pth files. This file must exist in the
> root filesystem so that python 2.7 can locate and import the installed modules
> in the host system.
>
> Due to the import of the changeset aaaac4c545623d8818de2d3fa71d9d63b717c575
> from the Classic OpenEmbedded Development Tree in changeset
> 733dc27ecf485a0ec5318534dfbbc9491c08df8f, the easyinstall.pth file is removed.
> The original changeset claims that python 2.5 can import packages without the
> easyinstall.pth file. However in my experience, python 2.7 cannot import
> packages without this file. Furthermore, the easyinstall.pth file must
> accumulate entries when multiple packages are installed with easyinstall.
>
> The easyinstall class provides a simple postinst script that adds the content
> of the variable EASYINSTALL_${PN} to the easyinstall.pth file and initializes
> the file if necessary.
> ---
>  meta/classes/easyinstall.bbclass |   11 +++++++++++
>  1 file changed, 11 insertions(+)
>  create mode 100644 meta/classes/easyinstall.bbclass
>
> diff --git a/meta/classes/easyinstall.bbclass b/meta/classes/easyinstall.bbclass
> new file mode 100644
> index 0000000..8ae975d
> --- /dev/null
> +++ b/meta/classes/easyinstall.bbclass
> @@ -0,0 +1,11 @@
> +
> +pkg_postinst_${PN} () {
> +       if test ! -e ${PYTHON_SITEPACKAGES_DIR}/easy-install.pth; then
> +            cat > ${PYTHON_SITEPACKAGES_DIR}/easy-install.pth << EOF
> +import sys; sys.__plen = len(sys.path)
> +import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)

All this need to be in a single line? Seems ugly and hard to read for me.

> +EOF
> +        fi
> +        sed -i '$ i ${EASYINSTALL_${PN}}' ${PYTHON_SITEPACKAGES_DIR}/easy-install.pth
> +}
> +
> --
> 1.7.9.5
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core



--
Otavio Salvador                             O.S. Systems
E-mail: otavio at ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br




More information about the Openembedded-core mailing list