[PATCH] gnu: Correct Inkscape extension dependencies

  • Done
  • quality assurance status badge
Details
2 participants
  • Ekaitz Zarraga
  • Christopher Baines
Owner
unassigned
Submitted by
Ekaitz Zarraga
Severity
normal
E
E
Ekaitz Zarraga wrote on 23 Oct 2020 12:32
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
vhaTS7H_ai2iWTP_d9fg9ZxRqg8MCGrEEnlou7YLr-e-Id0HlC7wGpDzyPjOTGTdmyG6VIRgT2SYNvJuEJ8bUp7du8S2SVAsN9vFlXfGpCo=@elenq.tech
Hi,

This patch is the result of the guix-devel discussion about Inkscape's errors during import-export. Looks like the Inkscape package was not fully packaged because the extensions' dependencies were not included. This patch includes python-scour package, one missing dependency needed for optimized SVG exports and adds the needed dependencies to the inkscape package.

Thanks!


From 47b9eaec1715ad44e0156bf29362af47c103d02e Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <ekaitz@elenq.tech>
Date: Wed, 21 Oct 2020 19:08:20 +0200
Subject: [PATCH] gnu: Correct Inkscape extension dependencies

* gnu/packages/inkscape.scm (inkscape@1.0.1): Add dependencies.
* gnu/packages/python-xyz.scm (python-scour): New variable.
---
gnu/packages/inkscape.scm | 28 ++++++++++++++++++++++++++--
gnu/packages/python-xyz.scm | 26 ++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 2 deletions(-)

Toggle diff (101 lines)
diff --git a/gnu/packages/inkscape.scm b/gnu/packages/inkscape.scm
index 4ac3cf3966..85b4b5020f 100644
--- a/gnu/packages/inkscape.scm
+++ b/gnu/packages/inkscape.scm
@@ -6,6 +6,7 @@
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020 Boris A. Dekshteyn <boris.dekshteyn@gmail.com>
+;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -44,6 +45,7 @@
#:use-module (gnu packages pdf)
#:use-module (gnu packages popt)
#:use-module (gnu packages python)
+ #:use-module (gnu packages python-xyz)
#:use-module (gnu packages xml)
#:use-module (gnu packages ghostscript)
#:use-module (gnu packages fontutils)
@@ -250,7 +252,25 @@ endif()~%~%"
(add-after 'install 'glib-or-gtk-compile-schemas
(assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
(add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
- (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
+ (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
+ (add-after 'install 'wrap-program
+ ;; Ensure correct Python at runtime.
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (python (assoc-ref inputs "python"))
+ (file (string-append out "/bin/inkscape"))
+ (path (string-append
+ out
+ "/lib/python"
+ ,(version-major+minor
+ (package-version python))
+ "/site-packages:"
+ (getenv "PYTHONPATH"))))
+ (wrap-program file
+ `("PYTHONPATH" ":" prefix (,path))
+ `("PATH" ":" prefix
+ (,(string-append python "/bin:")))))
+ #t)))))
(inputs
`(("aspell" ,aspell)
("autotrace" ,autotrace)
@@ -283,7 +303,11 @@ endif()~%~%"
("googletest" ,googletest)
("perl" ,perl)
("pkg-config" ,pkg-config)
- ("python" ,python-wrapper)))
+ ("python" ,python-wrapper)
+ ("python-scour" ,python-scour)
+ ("python-pyserial" ,python-pyserial)
+ ("python-numpy" ,python-numpy)
+ ("python-lxml" ,python-lxml)))
(home-page "https://inkscape.org/")
(synopsis "Vector graphics editor")
(description "Inkscape is a vector graphics editor. What sets Inkscape
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 575ce40ac8..fe2e77a338 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -88,6 +88,7 @@
;;; Copyright © 2020 Joseph LaFreniere <joseph@lafreniere.xyz>
;;; Copyright © 2020 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
;;; Copyright © 2020 Bonface Munyoki Kilyungi <bonfacemunyoki@gmail.com>
+;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -22524,3 +22525,28 @@ applications with variable CPU loads).")

(define-public python2-parallel
(package-with-python2 python-parallel))
+
+(define-public python-scour
+ (package
+ (name "python-scour")
+ (version "038.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/scour-project/scour")
+ (commit
+ (string-append "v" version))))
+ (sha256
+ (base32 "0rgiypb9ig8x4rl3hfzpy7kwnx1q3064nvlrv4fk0dnp84girn0v"))))
+ (propagated-inputs
+ `(("python-six" ,python-six)))
+ (build-system python-build-system)
+ (home-page "https://github.com/scour-project/scour")
+ (synopsis "Scour is an SVG optimizer/cleaner written in Python")
+ (description "The goal of Scour is to output a file that renderes
+identically at a fraction of the size by removing a lot of redundant
+information created by most SVG editors. Optimization options are typically
+lossless but can be tweaked for more agressive cleaning.")
+ (license license:asl2.0)))
--
2.28.0
E
E
Ekaitz Zarraga wrote on 24 Oct 2020 01:03
(name . 44170@debbugs.gnu.org)(address . 44170@debbugs.gnu.org)
xtWDFjfh0a5STiw0YCHBoY6znQvYFe1eF7FgAnpC0LzS1PrUaFxnqdGfL-B2N4AK4cDBf2Zd54AMGy2NgSOOPT8oFrpxBLp-reD9nFJG6yI=@elenq.tech
Updated with file-name thanks to Christopher Baines' help.

Guix lint is not complaining anymore about the file name.

(it complains about the version but it's because of a bad naming system
upstream)



From 931147a8dfe30f96e634a9aabc58955d2ff1b475 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <ekaitz@elenq.tech>
Date: Wed, 21 Oct 2020 19:08:20 +0200
Subject: [PATCH] gnu: Correct Inkscape extension dependencies

* gnu/packages/inkscape.scm (inkscape@1.0.1): Add dependencies.
* gnu/packages/python-xyz.scm (python-scour): New variable.
---
gnu/packages/inkscape.scm | 28 ++++++++++++++++++++++++++--
gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++
2 files changed, 53 insertions(+), 2 deletions(-)

Toggle diff (102 lines)
diff --git a/gnu/packages/inkscape.scm b/gnu/packages/inkscape.scm
index 4ac3cf3966..85b4b5020f 100644
--- a/gnu/packages/inkscape.scm
+++ b/gnu/packages/inkscape.scm
@@ -6,6 +6,7 @@
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020 Boris A. Dekshteyn <boris.dekshteyn@gmail.com>
+;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -44,6 +45,7 @@
#:use-module (gnu packages pdf)
#:use-module (gnu packages popt)
#:use-module (gnu packages python)
+ #:use-module (gnu packages python-xyz)
#:use-module (gnu packages xml)
#:use-module (gnu packages ghostscript)
#:use-module (gnu packages fontutils)
@@ -250,7 +252,25 @@ endif()~%~%"
(add-after 'install 'glib-or-gtk-compile-schemas
(assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
(add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
- (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
+ (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
+ (add-after 'install 'wrap-program
+ ;; Ensure correct Python at runtime.
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (python (assoc-ref inputs "python"))
+ (file (string-append out "/bin/inkscape"))
+ (path (string-append
+ out
+ "/lib/python"
+ ,(version-major+minor
+ (package-version python))
+ "/site-packages:"
+ (getenv "PYTHONPATH"))))
+ (wrap-program file
+ `("PYTHONPATH" ":" prefix (,path))
+ `("PATH" ":" prefix
+ (,(string-append python "/bin:")))))
+ #t)))))
(inputs
`(("aspell" ,aspell)
("autotrace" ,autotrace)
@@ -283,7 +303,11 @@ endif()~%~%"
("googletest" ,googletest)
("perl" ,perl)
("pkg-config" ,pkg-config)
- ("python" ,python-wrapper)))
+ ("python" ,python-wrapper)
+ ("python-scour" ,python-scour)
+ ("python-pyserial" ,python-pyserial)
+ ("python-numpy" ,python-numpy)
+ ("python-lxml" ,python-lxml)))
(home-page "https://inkscape.org/")
(synopsis "Vector graphics editor")
(description "Inkscape is a vector graphics editor. What sets Inkscape
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 575ce40ac8..426d87e9f0 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -88,6 +88,7 @@
;;; Copyright © 2020 Joseph LaFreniere <joseph@lafreniere.xyz>
;;; Copyright © 2020 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
;;; Copyright © 2020 Bonface Munyoki Kilyungi <bonfacemunyoki@gmail.com>
+;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -22524,3 +22525,29 @@ applications with variable CPU loads).")

(define-public python2-parallel
(package-with-python2 python-parallel))
+
+(define-public python-scour
+ (package
+ (name "python-scour")
+ (version "038.1")
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/scour-project/scour")
+ (commit
+ (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0rgiypb9ig8x4rl3hfzpy7kwnx1q3064nvlrv4fk0dnp84girn0v"))))
+ (propagated-inputs
+ `(("python-six" ,python-six)))
+ (build-system python-build-system)
+ (home-page "https://github.com/scour-project/scour")
+ (synopsis "Scour is an SVG optimizer/cleaner written in Python")
+ (description "The goal of Scour is to output a file that renderes
+identically at a fraction of the size by removing a lot of redundant
+information created by most SVG editors. Optimization options are typically
+lossless but can be tweaked for more agressive cleaning.")
+ (license license:asl2.0)))
--
2.28.0
C
C
Christopher Baines wrote on 24 Oct 2020 21:55
(name . Ekaitz Zarraga)(address . ekaitz@elenq.tech)(name . 44170@debbugs.gnu.org)(address . 44170@debbugs.gnu.org)
87mu0bbdqx.fsf@cbaines.net
Ekaitz Zarraga <ekaitz@elenq.tech> writes:

Toggle quote (7 lines)
> Updated with file-name thanks to Christopher Baines' help.
>
> Guix lint is not complaining anymore about the file name.
>
> (it complains about the version but it's because of a bad naming system
> upstream)

I've had a proper look at this patch now. In general, especially for
adding new packages, do one thing per commit. I've split out the
addition of python-scour in to it's own commit and pushed that now.

I had some thoughts on the inkscape changes though.

Toggle quote (51 lines)
> From 931147a8dfe30f96e634a9aabc58955d2ff1b475 Mon Sep 17 00:00:00 2001
> From: Ekaitz Zarraga <ekaitz@elenq.tech>
> Date: Wed, 21 Oct 2020 19:08:20 +0200
> Subject: [PATCH] gnu: Correct Inkscape extension dependencies
>
> * gnu/packages/inkscape.scm (inkscape@1.0.1): Add dependencies.
> * gnu/packages/python-xyz.scm (python-scour): New variable.
> ---
> gnu/packages/inkscape.scm | 28 ++++++++++++++++++++++++++--
> gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++
> 2 files changed, 53 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/inkscape.scm b/gnu/packages/inkscape.scm
> index 4ac3cf3966..85b4b5020f 100644
> --- a/gnu/packages/inkscape.scm
> +++ b/gnu/packages/inkscape.scm
> @@ -6,6 +6,7 @@
> ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
> ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
> ;;; Copyright © 2020 Boris A. Dekshteyn <boris.dekshteyn@gmail.com>
> +;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -44,6 +45,7 @@
> #:use-module (gnu packages pdf)
> #:use-module (gnu packages popt)
> #:use-module (gnu packages python)
> + #:use-module (gnu packages python-xyz)
> #:use-module (gnu packages xml)
> #:use-module (gnu packages ghostscript)
> #:use-module (gnu packages fontutils)
> @@ -250,7 +252,25 @@ endif()~%~%"
> (add-after 'install 'glib-or-gtk-compile-schemas
> (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
> (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
> - (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
> + (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
> + (add-after 'install 'wrap-program
> + ;; Ensure correct Python at runtime.
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (let* ((out (assoc-ref outputs "out"))
> + (python (assoc-ref inputs "python"))
> + (file (string-append out "/bin/inkscape"))
> + (path (string-append
> + out
> + "/lib/python"
> + ,(version-major+minor
> + (package-version python))
> + "/site-packages:"

I had a look in the output, and it doesn't contain lib/python, so this
bit won't do anything as far as I can see? The PYTHONPATH bit is fine.

Toggle quote (6 lines)
> + (getenv "PYTHONPATH"))))
> + (wrap-program file
> + `("PYTHONPATH" ":" prefix (,path))
> + `("PATH" ":" prefix
> + (,(string-append python "/bin:")))))

The : after /bin is unnecessary.

Also, it looks like python-wrapper is already referenced lots in the
output, did you have a specific reason why wrapping inkscape with the
PATH was useful?

Toggle quote (15 lines)
> + #t)))))
> (inputs
> `(("aspell" ,aspell)
> ("autotrace" ,autotrace)
> @@ -283,7 +303,11 @@ endif()~%~%"
> ("googletest" ,googletest)
> ("perl" ,perl)
> ("pkg-config" ,pkg-config)
> - ("python" ,python-wrapper)))
> + ("python" ,python-wrapper)
> + ("python-scour" ,python-scour)
> + ("python-pyserial" ,python-pyserial)
> + ("python-numpy" ,python-numpy)
> + ("python-lxml" ,python-lxml)))

So, before python-wrapper was a native-input, and you've added some
Python packages as native inputs.

The distinction for inkscape between an input and a native input is
mostly academic at this point, because the meson build system doesn't
support cross builds.

However, inkscape already uses references python-wrapper in its output,
so it should probably be an input. With this change, you're also setting
out that inkscape should be able to use these Python libraries at
runtime, hence they should be inputs (matching the architecture you're
building for), rather than native inputs (matching the architecture
you're building on).

Does that make sense?

Thanks,

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl+UhqdfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xc9gxAAjLDLXqVqwcsd5lhpT+RKC7mYNjYh1FaE
ilXkdp+3FwZMux8lkpqACqwI7E5kHmp1JhD0j6PyD8yxzBHle+jfsbN5HJ5lgIS9
Nhbe5MwZcFjpPXzZSNj44fTRi+7kxefyLHu/1nOmtO6uMQsRVsb1jKZh0IbO1V6z
AuMtK73upBCOqxyeG4AJgEspTEAYq75IgQ64zeZIemSYkSf5Zl2qhVTQYogdZRXD
UMCsNI1MJ0anRU6M+g+kLtAQxP+59MIIk1764GvJzGQm3+56WkdKlL5DvLnFf+8Y
JU/WqvaRq1n8dW01VLhGVhetUHTqEQX2R+uoQZ9SG2pSBiUQvR1Jv4u2IFeHKeYt
Las5xG666dXNspR8FTQcOLkbQCWaa+BFvc+DM5pRroGUxSVsibLM5qGuYLGRrs4C
qoNZNKqnVuPxtpvPxU6kThnWfx9accF5NLfuU1kY5wEhZRDxRWXni4xhRmwkisK2
XO7Z5aiuS7e1A1nmOMCcakV+/ElCutqY/4kXzOUYKKDGKFoDATi+oFel//3M0Qs1
cEw2LFBmxY5v39yQeC396ADNfW293aWgoRSvlu7gEQBuU88w7trh1YIp/aAb+iIe
CSNG2Gr+DfWNUPnO5SojyaQlC4hyGHTn8JeD58FJndj8xDxCNaE54J3sKA/4ustS
QLclbqq9VeM=
=/E54
-----END PGP SIGNATURE-----

E
E
Ekaitz Zarraga wrote on 24 Oct 2020 23:31
(name . Christopher Baines)(address . mail@cbaines.net)(name . 44170@debbugs.gnu.org)(address . 44170@debbugs.gnu.org)
khNSOQlCgQUMMPPih274U1RU9zftDkw7N6UZSIrv__pyPZP9_Nea5N211731pkpI7WIZ-i-YCeM3r0Y7VYvoqM5x1lyLG9lYwdXdhr_e4AE=@elenq.tech
Hi,

??????? Original Message ???????
On Saturday, October 24, 2020 9:55 PM, Christopher Baines <mail@cbaines.net> wrote:

Toggle quote (13 lines)
>
>
> Ekaitz Zarragaekaitz@elenq.tech writes:
>
> > Updated with file-name thanks to Christopher Baines' help.
> > Guix lint is not complaining anymore about the file name.
> > (it complains about the version but it's because of a bad naming system
> > upstream)
>
> I've had a proper look at this patch now. In general, especially for
> adding new packages, do one thing per commit. I've split out the
> addition of python-scour in to it's own commit and pushed that now.

Thanks.

I'll take that in account in the future.

Toggle quote (2 lines)
> I had some thoughts on the inkscape changes though.

I had some too, thanks for elaborating.

Toggle quote (5 lines)
> >
> > - (,(string-append python "/bin:")))))
>
> The : after /bin is unnecessary.

I copied all this from Kicad's package because it's a software
that has a similar python plugin style.

Toggle quote (4 lines)
> Also, it looks like python-wrapper is already referenced lots in the
> output, did you have a specific reason why wrapping inkscape with the
> PATH was useful?

Not really.
I just copied it from kicad and followed the discussion at guix-devel...
I thought it was necessary but watching what python-wrapper does it's
probably not necessary. I'll try it without the PATH and remove it if
it's not useful.

I'll compare with kicad's package too, because they are very similar
so they should have some relation on this too.


Toggle quote (19 lines)
> >
> >
>
> So, before python-wrapper was a native-input, and you've added some
> Python packages as native inputs.
>
> The distinction for inkscape between an input and a native input is
> mostly academic at this point, because the meson build system doesn't
> support cross builds.
>
> However, inkscape already uses references python-wrapper in its output,
> so it should probably be an input. With this change, you're also setting
> out that inkscape should be able to use these Python libraries at
> runtime, hence they should be inputs (matching the architecture you're
> building for), rather than native inputs (matching the architecture
> you're building on).
>
> Does that make sense?

Something obviously doesn't. :)
In my understanding, python should be an `input` but it was already in
`native-inputs`, I don't know why. So I considered all the rest of the
python-related packages should be in the same block.

If I did this package I would add python-* and python itself as inputs.

So, I follow your explanation and it's what I understood, but I don't
get why were python related things in native-inputs before. That
confused me.

I'll move those to inputs. Could you explain or find a reason why python
wasn't an input before? is it just an error?

Toggle quote (6 lines)
>
> Thanks,
>
> Chris


Thank you for your time and for the explanations. Really helpful.

I'll follow up with the updated patch soonish. Only with the Inkscape
part.

Best,
Ekaitz
C
C
Christopher Baines wrote on 25 Oct 2020 00:14
(name . Ekaitz Zarraga)(address . ekaitz@elenq.tech)(name . 44170@debbugs.gnu.org)(address . 44170@debbugs.gnu.org)
87r1pn9sqk.fsf@cbaines.net
Ekaitz Zarraga <ekaitz@elenq.tech> writes:

Toggle quote (5 lines)
>> The : after /bin is unnecessary.
>
> I copied all this from Kicad's package because it's a software
> that has a similar python plugin style.

That's fine, it's also unnecessary there :)

If you pull the generated shell out of the bin/kicad or bin/inkscape
file, and play around with it in a shell, you should see something like:

→ export PATH="/gnu/store/11l2qmzfgsp7k345mv6x1vn64q8330kw-python-wrapper-3.8.2/bin:${PATH:+:}$PATH"

→ echo $PATH
/gnu/store/11l2qmzfgsp7k345mv6x1vn64q8330kw-python-wrapper-3.8.2/bin::/gnu/store/hgh67ilwsbx6v2irc7vgrnv354cv4h8a-profile/bin


Note the double colon, I don't think it's a problem in terms of
functionality, but just in case someone copies this from inkscape as an
example, it would be good not to do the same here.

Note, there's no need to fix this in kicad. If you do want to, I'd
submit a separate commit under a seperate bug.

Toggle quote (13 lines)
>> Also, it looks like python-wrapper is already referenced lots in the
>> output, did you have a specific reason why wrapping inkscape with the
>> PATH was useful?
>
> Not really.
> I just copied it from kicad and followed the discussion at guix-devel...
> I thought it was necessary but watching what python-wrapper does it's
> probably not necessary. I'll try it without the PATH and remove it if
> it's not useful.
>
> I'll compare with kicad's package too, because they are very similar
> so they should have some relation on this too.

Sounds good, it's possible something, or plugins expect the PATH to have
python on it, if so, that's fine, but it would be good to note the
reason in a comment. Otherwise, this bit can be removed.

Toggle quote (30 lines)
>> So, before python-wrapper was a native-input, and you've added some
>> Python packages as native inputs.
>>
>> The distinction for inkscape between an input and a native input is
>> mostly academic at this point, because the meson build system doesn't
>> support cross builds.
>>
>> However, inkscape already uses references python-wrapper in its output,
>> so it should probably be an input. With this change, you're also setting
>> out that inkscape should be able to use these Python libraries at
>> runtime, hence they should be inputs (matching the architecture you're
>> building for), rather than native inputs (matching the architecture
>> you're building on).
>>
>> Does that make sense?
>
> Something obviously doesn't. :)
> In my understanding, python should be an `input` but it was already in
> `native-inputs`, I don't know why. So I considered all the rest of the
> python-related packages should be in the same block.
>
> If I did this package I would add python-* and python itself as inputs.
>
> So, I follow your explanation and it's what I understood, but I don't
> get why were python related things in native-inputs before. That
> confused me.
>
> I'll move those to inputs. Could you explain or find a reason why python
> wasn't an input before? is it just an error?

Well, error is a strong word, in this case, given the build system
doesn't support building for a non-native architecture, it's sort of a
non-issue. But I would view it as something you're fixing in addition to
the changes you're making.

It didn't (and still doesn't to some extent) matter that the Python
stuff was/is in native-inputs, because cross building this package is
impossible because of the build system.

However, in case the build system changes to support this, to be
consistent with other package definitions, and to be consistent with the
general rule that you don't reference native-inputs from the outputs (at
least I think that's a rule or at least strong convention), having the
Python stuff in inputs is better. Even if the package builds just the
same.

Toggle quote (5 lines)
> Thank you for your time and for the explanations. Really helpful.
>
> I'll follow up with the updated patch soonish. Only with the Inkscape
> part.

You're welcome :) I look forward to it.

Thanks,

Chris
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl+Up0NfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XfCxA//QwhdFh5HZfmjq90dW4q3B5bQOeFcIFNv
Uf+qyrv+e/VF+6umESRskAZMF8eSyyGq/GQ8XaDxHWljshMqO5o3EVqm5o9Cs/kY
U3hswcOOGMJFKTgceSjgi0FsISd3O6QIP4EBFXPXbnv5cOQJnI+YN4fd1wxYimZq
eeIHajIK3LOjuAqIAfZVyasBBndnCyVu1F81FVU5Z/G0tMdx/YsEAaHaBxYWEsUS
usvnjHAH/M48a8wjwWWs5bEgogNe5zgRU5akOYcm000olZg3FXD88BDncwE/hDFU
bVa+17HMvPOmbC9PgCPblulK6gfufYHtu0jS2wrUWZ3Hy/hJnZ55tp43i2uiQsKY
tBKOUU8I0l2JQEUZUQAaU8JX4MFAScNFEk/IrhNhcRODw7TwssBLiB4OXr6S4Dg+
tRXRosXbX525cUDDJibId7T/XYck3o4fAhSD32jWbAV1di5luZHfRac8WxXJG6FQ
K37x/dszk2ONTPb9E+LKJqL5TtEFVIP961OrA+GGzHUTCJ+MX41HsWBcquwgwpPV
xc+ZuMgoDtIomliRc8nG/n+OWUvJHUkr6hvlgSlnyUTP0yfz4tRtXVsBtZjB3K+s
CDtfvbU/eqJLTVQe9gaQ806iW0Lazgzv972DvVLCt3Uw/QBgKXzJKdvWW768Aw0p
iqn6YLE5pRM=
=c8dk
-----END PGP SIGNATURE-----

E
E
Ekaitz Zarraga wrote on 25 Oct 2020 13:23
(name . Christopher Baines)(address . mail@cbaines.net)(name . 44170@debbugs.gnu.org)(address . 44170@debbugs.gnu.org)
c5xjZRf7PwKIJfcUW5tLOUtY2eJUE1J5OV4lmeyBftR49MG0zijaroak-G2vmxk_5mBKIdAivDKVWYbwPaqIgKliGiSaCvi7D8W1Hh0RYPg=@elenq.tech
Hi Christopher,

Thanks for elaborating further

??????? Original Message ???????
Toggle quote (13 lines)
> → export PATH="/gnu/store/11l2qmzfgsp7k345mv6x1vn64q8330kw-python-wrapper-3.8.2/bin:${PATH:+:}$PATH"
>
> → echo $PATH
> /gnu/store/11l2qmzfgsp7k345mv6x1vn64q8330kw-python-wrapper-3.8.2/bin::/gnu/store/hgh67ilwsbx6v2irc7vgrnv354cv4h8a-profile/bin
>
> Note the double colon, I don't think it's a problem in terms of
> functionality, but just in case someone copies this from inkscape as an
> example, it would be good not to do the same here.
>
> Note, there's no need to fix this in kicad. If you do want to, I'd
> submit a separate commit under a seperate bug.
>

I see! thanks!

Toggle quote (19 lines)
> > wasn't an input before? is it just an error?
>
> Well, error is a strong word, in this case, given the build system
> doesn't support building for a non-native architecture, it's sort of a
> non-issue. But I would view it as something you're fixing in addition to
> the changes you're making.
>
> It didn't (and still doesn't to some extent) matter that the Python
> stuff was/is in native-inputs, because cross building this package is
> impossible because of the build system.
>
> However, in case the build system changes to support this, to be
> consistent with other package definitions, and to be consistent with the
> general rule that you don't reference native-inputs from the outputs (at
> least I think that's a rule or at least strong convention), having the
> Python stuff in inputs is better. Even if the package builds just the
> same.


I see what you mean, great.
I just moved python-wrapper to inputs and separated the commit so now
it's just inkscape's changes.

Thanks for your patience!

From 5c3043aea4d98823089b8438bb4573d32e28d899 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <ekaitz@elenq.tech>
Date: Sun, 25 Oct 2020 13:04:15 +0100
Subject: [PATCH] gnu: Correct Inkscape extension dependencies

* gnu/packages/inkscape.scm (inkscape@1.0.1): Add dependencies.
---
gnu/packages/inkscape.scm | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)

Toggle diff (68 lines)
diff --git a/gnu/packages/inkscape.scm b/gnu/packages/inkscape.scm
index 4ac3cf3966..66756b70a6 100644
--- a/gnu/packages/inkscape.scm
+++ b/gnu/packages/inkscape.scm
@@ -6,6 +6,7 @@
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020 Boris A. Dekshteyn <boris.dekshteyn@gmail.com>
+;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -44,6 +45,7 @@
#:use-module (gnu packages pdf)
#:use-module (gnu packages popt)
#:use-module (gnu packages python)
+ #:use-module (gnu packages python-xyz)
#:use-module (gnu packages xml)
#:use-module (gnu packages ghostscript)
#:use-module (gnu packages fontutils)
@@ -250,7 +252,23 @@ endif()~%~%"
(add-after 'install 'glib-or-gtk-compile-schemas
(assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
(add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
- (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
+ (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
+ (add-after 'install 'wrap-program
+ ;; Ensure correct Python at runtime.
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (python (assoc-ref inputs "python"))
+ (file (string-append out "/bin/inkscape"))
+ (path (string-append
+ out
+ "/lib/python"
+ ,(version-major+minor
+ (package-version python))
+ "/site-packages:"
+ (getenv "PYTHONPATH"))))
+ (wrap-program file
+ `("PYTHONPATH" ":" prefix (,path))))
+ #t)))))
(inputs
`(("aspell" ,aspell)
("autotrace" ,autotrace)
@@ -275,15 +293,19 @@ endif()~%~%"
("popt" ,popt)
("potrace" ,potrace)
("lcms" ,lcms)
- ("boost" ,boost)))
+ ("boost" ,boost)
+ ("python" ,python-wrapper)
+ ("python-scour" ,python-scour)
+ ("python-pyserial" ,python-pyserial)
+ ("python-numpy" ,python-numpy)
+ ("python-lxml" ,python-lxml)))
(native-inputs
`(("imagemagick" ,imagemagick) ;for tests
("intltool" ,intltool)
("glib" ,glib "bin")
("googletest" ,googletest)
("perl" ,perl)
- ("pkg-config" ,pkg-config)
- ("python" ,python-wrapper)))
+ ("pkg-config" ,pkg-config)))
(home-page "https://inkscape.org/")
(synopsis "Vector graphics editor")
(description "Inkscape is a vector graphics editor. What sets Inkscape
--
2.28.0
C
C
Christopher Baines wrote on 26 Oct 2020 16:56
(name . Ekaitz Zarraga)(address . ekaitz@elenq.tech)(address . 44170-done@debbugs.gnu.org)
87r1plyo9m.fsf@cbaines.net
Ekaitz Zarraga <ekaitz@elenq.tech> writes:

Toggle quote (45 lines)
> Hi Christopher,
>
> Thanks for elaborating further
>
> ??????? Original Message ???????
>> → export PATH="/gnu/store/11l2qmzfgsp7k345mv6x1vn64q8330kw-python-wrapper-3.8.2/bin:${PATH:+:}$PATH"
>>
>> → echo $PATH
>> /gnu/store/11l2qmzfgsp7k345mv6x1vn64q8330kw-python-wrapper-3.8.2/bin::/gnu/store/hgh67ilwsbx6v2irc7vgrnv354cv4h8a-profile/bin
>>
>> Note the double colon, I don't think it's a problem in terms of
>> functionality, but just in case someone copies this from inkscape as an
>> example, it would be good not to do the same here.
>>
>> Note, there's no need to fix this in kicad. If you do want to, I'd
>> submit a separate commit under a seperate bug.
>>
>
> I see! thanks!
>
>> > wasn't an input before? is it just an error?
>>
>> Well, error is a strong word, in this case, given the build system
>> doesn't support building for a non-native architecture, it's sort of a
>> non-issue. But I would view it as something you're fixing in addition to
>> the changes you're making.
>>
>> It didn't (and still doesn't to some extent) matter that the Python
>> stuff was/is in native-inputs, because cross building this package is
>> impossible because of the build system.
>>
>> However, in case the build system changes to support this, to be
>> consistent with other package definitions, and to be consistent with the
>> general rule that you don't reference native-inputs from the outputs (at
>> least I think that's a rule or at least strong convention), having the
>> Python stuff in inputs is better. Even if the package builds just the
>> same.
>
>
> I see what you mean, great.
> I just moved python-wrapper to inputs and separated the commit so now
> it's just inkscape's changes.
>
> Thanks for your patience!

You're welcome :) I made some tweaks (described below) and pushed this
as 24b233d45c2a04a7a011397234b29fd5d7133110.

Toggle quote (7 lines)
> From 5c3043aea4d98823089b8438bb4573d32e28d899 Mon Sep 17 00:00:00 2001
> From: Ekaitz Zarraga <ekaitz@elenq.tech>
> Date: Sun, 25 Oct 2020 13:04:15 +0100
> Subject: [PATCH] gnu: Correct Inkscape extension dependencies
>
> * gnu/packages/inkscape.scm (inkscape@1.0.1): Add dependencies.

I rewrote the commit message to the following, I think this is more in
line with the style.

gnu: inkscape: Correct extension dependencies.

* gnu/packages/inkscape.scm (inkscape-1.0)[arguments]: Add wrap-program phase.
[inputs]: Move python-wrapper to inputs, and add several python libraries.
[native-inputs]: Remove python-wrapper, as it has moved to inputs.

Toggle quote (47 lines)
> ---
> gnu/packages/inkscape.scm | 30 ++++++++++++++++++++++++++----
> 1 file changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/gnu/packages/inkscape.scm b/gnu/packages/inkscape.scm
> index 4ac3cf3966..66756b70a6 100644
> --- a/gnu/packages/inkscape.scm
> +++ b/gnu/packages/inkscape.scm
> @@ -6,6 +6,7 @@
> ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
> ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
> ;;; Copyright © 2020 Boris A. Dekshteyn <boris.dekshteyn@gmail.com>
> +;;; Copyright © 2020 Ekaitz Zarraga <ekaitz@elenq.tech>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -44,6 +45,7 @@
> #:use-module (gnu packages pdf)
> #:use-module (gnu packages popt)
> #:use-module (gnu packages python)
> + #:use-module (gnu packages python-xyz)
> #:use-module (gnu packages xml)
> #:use-module (gnu packages ghostscript)
> #:use-module (gnu packages fontutils)
> @@ -250,7 +252,23 @@ endif()~%~%"
> (add-after 'install 'glib-or-gtk-compile-schemas
> (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
> (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
> - (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
> + (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
> + (add-after 'install 'wrap-program
> + ;; Ensure correct Python at runtime.
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (let* ((out (assoc-ref outputs "out"))
> + (python (assoc-ref inputs "python"))
> + (file (string-append out "/bin/inkscape"))
> + (path (string-append
> + out
> + "/lib/python"
> + ,(version-major+minor
> + (package-version python))
> + "/site-packages:"
> + (getenv "PYTHONPATH"))))
> + (wrap-program file
> + `("PYTHONPATH" ":" prefix (,path))))
> + #t)))))

As before, because inkscape's lib doesn't contain anything Python
related, I just wrapped with the PYTHONPATH.

Toggle quote (26 lines)
> (inputs
> `(("aspell" ,aspell)
> ("autotrace" ,autotrace)
> @@ -275,15 +293,19 @@ endif()~%~%"
> ("popt" ,popt)
> ("potrace" ,potrace)
> ("lcms" ,lcms)
> - ("boost" ,boost)))
> + ("boost" ,boost)
> + ("python" ,python-wrapper)
> + ("python-scour" ,python-scour)
> + ("python-pyserial" ,python-pyserial)
> + ("python-numpy" ,python-numpy)
> + ("python-lxml" ,python-lxml)))
> (native-inputs
> `(("imagemagick" ,imagemagick) ;for tests
> ("intltool" ,intltool)
> ("glib" ,glib "bin")
> ("googletest" ,googletest)
> ("perl" ,perl)
> - ("pkg-config" ,pkg-config)
> - ("python" ,python-wrapper)))
> + ("pkg-config" ,pkg-config)))
> (home-page "https://inkscape.org/")
> (synopsis "Vector graphics editor")
> (description "Inkscape is a vector graphics editor. What sets Inkscape
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl+W8aVfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9XfqKA/+K7NzpMY1fVI3MLIjoGaVy1ufKrsQ5AkZ
kMcAw5Ob6cQ3HhqzwFM4cGkHxT37sPC2basD9BNNp5rSJ5pXHICDmUB5IBNnIM+C
SfI5WFHGn/S0mCh7HB6rbJqhDj/7IUD1yPb+uUoIkTb68IjcHRTIBfg/IV+7Jsv6
m3qi0bG+aP/xc4HUq14ucC5FK28I8sn0D0psagCRrfA3JUAYfKwPtcPUAsrzpMW8
70GLljQHx2/qYFIg53GgBPe4sE/jBkcZKzX3wv0mFRARPynCjGmEKIVw/KAHsFdX
VXrWc77ReJYcUiV0FX2vsshbwGw7j7BFOI8/3vmRR6BWm2f/x6UlGPt59HL43wJZ
YNBmq9togYbpX1q84eRBZbhAPXjgSlGq/mNibm0kA4e+JkBRxfmgzFKMfRt+CEND
m5A2cSow545k9Ir4r2sX4kMzVvDwklakaYLfpYkoUCUur90en32IyyTvqt18cy12
ACZwsy4SiV3Os2gopnqdO5H+/wbD71Kqz6B6yodW9GsqYBHcI4Gc5gM33vaSNW4w
WEJ/u60VD2q17BgA/EupooZ6DEevfMSU2C/XYluaC+Ht1bH6XKcm3cksLckBhX+8
4uQkIgvzCHN7dgyGH5knUuZZXM/QDr0l4BxzVoHnJFTKvUgdSZuVYu0SeaRrc4a6
4V3qbqZjWRg=
=owAA
-----END PGP SIGNATURE-----

Closed
?