[Nix-dev] Inkscape pythonEnv - .sif export - PYTHONPATH wrapping

Freddy Rietdijk fridh at fridh.nl
Fri Mar 3 16:14:47 CET 2017


You wrote the following to me directly:


> Can you try regression exporting .sif files?
> How to: Export -> select filter sif.
> A simple rectangle is enough, the error I get is "lxml" not found.
> Have a look at your commit: You left the comment there, but dropped teh
> wrapProgram (which actually fixes the filter).
>      # Make sure PyXML modules can be found at run-time.
> -    for i in "$out/bin/"*
> -    do
> -      wrapProgram "$i" --prefix PYTHONPATH :      \
> -       "$(toPythonPath ${pyxml}):$(toPythonPath ${lxml}):$(toPythonPath
> ${numpy})"  \
> -       --prefix PATH : ${python}/bin ||  \
> -        exit 2
> -    done


I get a SyntaxError when trying to export this, and it seems that's due to
an impurity; removing my Python installation resulted in a different error.
Apparently somewhere certain parts of Inkscape try to just call `python`
instead of the one that was passed as a `propagatedBuildInput` (note that
we shouldn't propagate the env here). Either we fix those references, or
add `${pythonEnv}/bin` to PATH with wrapProgram.

The reason those lines are removed is because an environment constructed
with symbolic links is used now instead. Therefore, there shouldn't be a
need anymore

On Fri, Mar 3, 2017 at 3:38 PM, Marc Weber <marco-oweber at gmx.de> wrote:

> A commit turning the list of pythonpackages into pythonEnv broke the
> export. The problem is I'm unsure how to suggest a proper fix to
> fridh at fridh.nl
> because there are many ways to fix:
>
> makeWrapper requires shell function toPythonPath provided by
> ${python}/nix-support/..
> which is "gone" using pythonEnv. Possibilities to fix
>
>   1) revert
>   2) "rescue" adding python2 to buildInputs (providing toPythonPath)
>       see PATCH below
>   3) improve pythonEnv lifting toPythonPath from shell to nix world
>   4a) improve pythonEnv adding a run-in-python-env sot hat the wrapped
>       script looks like
>       #!/bin/sh
>       /nix/store..../bin/python-env/bin/run-in-env /nix/store/...inkscape
> "$@"
>
>   4b) make it composable / sourcable
>
>       #!/bin/sh
>       source /nix/store..../bin/python-env/nix-support/env
>       /nix/store/...inkscape "$@"
>
> No idea which solution is best - thoughts?
>
> People who are maintaining python might want to take care of.
>
> Marc Weber
>
> immediate fix: PATCH
>
> diff --git a/pkgs/applications/graphics/inkscape/default.nix
> b/pkgs/applications/graphics/inkscape/default.nix
> index 2f72d00..53d612f 100644
> --- a/pkgs/applications/graphics/inkscape/default.nix
> +++ b/pkgs/applications/graphics/inkscape/default.nix
> @@ -31,12 +32,23 @@ stdenv.mkDerivation rec {
>      libxml2 libxslt glib gtkmm2 glibmm libsigcxx lcms boost gettext
>      makeWrapper intltool gsl poppler imagemagick libwpg librevenge
>      libvisio libcdr libexif automake114x cmake
> +
> +    python2 # provides toPythonPath
>    ];
>
>    enableParallelBuilding = true;
>
>    postInstall = ''
>      # Make sure PyXML modules can be found at run-time.
> +    for i in "$out/bin/"*
> +    do
> +      wrapProgram "$i" \
> +        --prefix PYTHONPATH : $(toPythonPath "${python2Env}") \
> +        --prefix PATH       : ${python2Env}/bin || \
> +        exit 2
> +    done
>      rm "$out/share/icons/hicolor/icon-theme.cache"
>    '';
>
> diff --git a/pkgs/applications/graphics/inkscape/default.nix
> b/pkgs/applications/graphics/inkscape/default.nix
> index 2f72d00..53d612f 100644
> --- a/pkgs/applications/graphics/inkscape/default.nix
> +++ b/pkgs/applications/graphics/inkscape/default.nix
> @@ -31,12 +32,23 @@ stdenv.mkDerivation rec {
>      libxml2 libxslt glib gtkmm2 glibmm libsigcxx lcms boost gettext
>      makeWrapper intltool gsl poppler imagemagick libwpg librevenge
>      libvisio libcdr libexif automake114x cmake
> +
> +    python2 # provides toPythonPath
>    ];
>
>    enableParallelBuilding = true;
>
>    postInstall = ''
>      # Make sure PyXML modules can be found at run-time.
> +
> +    # Make sure PyXML modules can be found at run-time.
> +    for i in "$out/bin/"*
> +    do
> +      wrapProgram "$i" \
> +        --prefix PYTHONPATH : $(toPythonPath "${python2Env}") \
> +        --prefix PATH       : ${python2Env}/bin || \
> +        exit 2
> +    done
>      rm "$out/share/icons/hicolor/icon-theme.cache"
>    '';
>
> diff --git a/pkgs/applications/graphics/inkscape/default.nix
> b/pkgs/applications/graphics/inkscape/default.nix
> index 2f72d00..53d612f 100644
> --- a/pkgs/applications/graphics/inkscape/default.nix
> +++ b/pkgs/applications/graphics/inkscape/default.nix
> @@ -31,12 +32,23 @@ stdenv.mkDerivation rec {
>      libxml2 libxslt glib gtkmm2 glibmm libsigcxx lcms boost gettext
>      makeWrapper intltool gsl poppler imagemagick libwpg librevenge
>      libvisio libcdr libexif automake114x cmake
> +
> +    python2 # provides toPythonPath
>    ];
>
>    enableParallelBuilding = true;
>
>    postInstall = ''
>      # Make sure PyXML modules can be found at run-time.
> +
> +    # Make sure PyXML modules can be found at run-time.
> +    for i in "$out/bin/"*
> +    do
> +      wrapProgram "$i" \
> +        --prefix PYTHONPATH : $(toPythonPath "${python2Env}") \
> +        --prefix PATH       : ${python2Env}/bin || \
> +        exit 2
> +    done
>      rm "$out/share/icons/hicolor/icon-theme.cache"
>    '';
>
> diff --git a/pkgs/applications/graphics/inkscape/default.nix
> b/pkgs/applications/graphics/inkscape/default.nix
> index 2f72d00..53d612f 100644
> --- a/pkgs/applications/graphics/inkscape/default.nix
> +++ b/pkgs/applications/graphics/inkscape/default.nix
> @@ -31,12 +32,23 @@ stdenv.mkDerivation rec {
>      libxml2 libxslt glib gtkmm2 glibmm libsigcxx lcms boost gettext
>      makeWrapper intltool gsl poppler imagemagick libwpg librevenge
>      libvisio libcdr libexif automake114x cmake
> +
> +    python2 # provides toPythonPath
>    ];
>
>    enableParallelBuilding = true;
>
>    postInstall = ''
>      # Make sure PyXML modules can be found at run-time.
> +
> +    # Make sure PyXML modules can be found at run-time.
> +    for i in "$out/bin/"*
> +    do
> +      wrapProgram "$i" \
> +        --prefix PYTHONPATH : $(toPythonPath "${python2Env}") \
> +        --prefix PATH       : ${python2Env}/bin || \
> +        exit 2
> +    done
>      rm "$out/share/icons/hicolor/icon-theme.cache"
>    '';
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20170303/258530ba/attachment-0001.html>


More information about the nix-dev mailing list