Subject: Re: [bug#72994] [PATCH] gnu: emacs-julia-snail: Vendor julia libraries.

From: Ludovic Courtès <[email-masked]>
Date: Mon, 16 Sep 2024 10:24:04 +0200

Hey Danny,

Danny Milosavljevic <[email-masked]> skribis:

> * gnu/packages/patches/emacs-julia-snail-1.3.1-vendor.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/emacs-xyz.scm (emacs-julia-snail)[arguments]<#:phases>[vendor]:
> New phase.
> [inputs]: Add julia-cstparser, julia-tokenize.
> [propagated-inputs]: Remove julia-cstparser, julia-tokenize.
> [source]: Add patch.
>
> Change-Id: I61c0a4493fcfd219809bcc35f8765be0928a7e81

[...]

> +          (add-after 'validate-compiled-autoloads 'vendor
> +            (lambda* (#:key inputs outputs #:allow-other-keys)
> +              (let* ((out (assoc-ref outputs "out"))
> +                     (base (dirname (car (find-files out "JuliaSnail.jl"))))
> +                     (vendor (string-append base "/vendor")))
> +                (mkdir-p vendor)
> +                (copy-recursively (string-append (assoc-ref inputs "julia-cstparser")
> +                                                 "/share/julia/loadpath/CSTParser")
> +                                  (string-append vendor "/CSTParser"))
> +                (copy-recursively (string-append (assoc-ref inputs "julia-tokenize")
> +                                                 "/share/julia/loadpath/Tokenize")

Use ‘search-input-directory’ rather than ‘assoc-ref’.

> +++ b/gnu/packages/patches/emacs-julia-snail-1.3.1-vendor.patch
> @@ -0,0 +1,57 @@
> +Author: Danny Milosavljevic <[email-masked]>
> +Date: 2024-09-03
> +License: GPL3+
> +
> +Previously, we propagated julia-cstparser and julia-tokenize. This would only
> +work if the user had installed julia in their profile (because only then
> +JULIA_LOAD_PATH of julia-cstparser would be propagated).
> +That doesn't seem likely or desireable.
> +
> +It turns out that it's not difficult to make julia read vendored packages.
> +Let's do that (since there's a comment inside JuliaSnail.jl that warns about
> +CSTParser APIs being easily incompatible, vendoring is better anyway).

I’m not sure I understand.  For most programming languages (Python,
etc.), we use propagated inputs like this.  How does that differ?

Normally we unbundle (“unvendor”?) libraries and this seems to go in the
opposite direction, right?

Thanks,
Ludo’.