unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob eaa38fb868e5174da312e9d4bc1792cb7c99a739 2678 bytes (raw)
name: gnu/packages/patches/emacs-julia-snail-1.3.1-vendor.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 
Author: Danny Milosavljevic <dannym@friendly-machines.com>
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).

diff -ru orig/4l8xr3ldffb30a44x157lj3asaj3ykls-emacs-julia-snail-1.3.1-checkout/JuliaSnail.jl 4l8xr3ldffb30a44x157lj3asaj3ykls-emacs-julia-snail-1.3.1-checkout/JuliaSnail.jl
--- orig/4l8xr3ldffb30a44x157lj3asaj3ykls-emacs-julia-snail-1.3.1-checkout/JuliaSnail.jl	2024-09-03 00:02:03.798373662 +0200
+++ 4l8xr3ldffb30a44x157lj3asaj3ykls-emacs-julia-snail-1.3.1-checkout/JuliaSnail.jl	2024-09-03 01:05:26.310766009 +0200
@@ -30,12 +30,12 @@
    catch err
       if isa(err, ArgumentError)
          if isfile(joinpath($dir, "Project.toml"))
-            # force dependency installation
-            Main.Pkg.activate($dir)
-            Main.Pkg.instantiate()
-            Main.Pkg.precompile()
-            # activate what was the first entry before Snail was pushed to the head of LOAD_PATH
-            Main.Pkg.activate(LOAD_PATH[2])
+             # force dependency installation
+             if isa(err, ArgumentError)
+                 error("Vendored dependencies not found. Please make sure the vendored packages are located in the 'vendor' directory.")
+             else
+                 rethrow(err)
+             end
          end
       end
    finally
@@ -51,11 +51,16 @@
 end
 
 @with_pkg_env (@__DIR__) begin
-   # list all external dependency imports here (from the appropriate Project.toml, either Snail's or an extension's):
-   import CSTParser
-   # check for dependency API compatibility
-   !isdefined(CSTParser, :iscall) &&
-     throw(ArgumentError("CSTParser API not compatible, must install Snail-specific version"))
+    @with_pkg_env (joinpath(@__DIR__, "vendor", "CSTParser")) begin
+        @with_pkg_env (joinpath(@__DIR__, "vendor", "Tokenize")) begin
+            println(LOAD_PATH)
+            # list all external dependency imports here (from the appropriate Project.toml, either Snail's or an extension's):
+            import CSTParser
+            # check for dependency API compatibility
+            !isdefined(CSTParser, :iscall) &&
+                throw(ArgumentError("CSTParser API not compatible, must install Snail-specific version"))
+        end
+    end
 end
 
 

debug log:

solving eaa38fb868 ...
found eaa38fb868 in https://yhetil.org/guix-patches/58ce361528f55e5ad76ed7da4123525a9e9375e5.1725319687.git.dannym@friendly-machines.com/

applying [1/1] https://yhetil.org/guix-patches/58ce361528f55e5ad76ed7da4123525a9e9375e5.1725319687.git.dannym@friendly-machines.com/
diff --git a/gnu/packages/patches/emacs-julia-snail-1.3.1-vendor.patch b/gnu/packages/patches/emacs-julia-snail-1.3.1-vendor.patch
new file mode 100644
index 0000000000..eaa38fb868

1:44: trailing whitespace.
 
1:62: trailing whitespace.
 
1:63: trailing whitespace.
 
Checking patch gnu/packages/patches/emacs-julia-snail-1.3.1-vendor.patch...
1:62: new blank line at EOF.
+
Applied patch gnu/packages/patches/emacs-julia-snail-1.3.1-vendor.patch cleanly.
warning: 4 lines add whitespace errors.

index at:
100644 eaa38fb868e5174da312e9d4bc1792cb7c99a739	gnu/packages/patches/emacs-julia-snail-1.3.1-vendor.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).