From 398350f5052c7bfd3cf787c75e65da5a7262cf85 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Thu, 15 Aug 2024 21:14:10 +0800 Subject: [PATCH] Split julia out --- include/source.h | 15 ----------- src/chsrc.c | 38 +--------------------------- src/recipe/catalog.c | 1 - src/recipe/lang/julia.c | 55 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 53 deletions(-) create mode 100644 src/recipe/lang/julia.c diff --git a/include/source.h b/include/source.h index fa3c7da..d322c25 100644 --- a/include/source.h +++ b/include/source.h @@ -181,20 +181,6 @@ pl_haskell_sources[] = { {&Bfsu, "https://mirrors.bfsu.edu.cn/hackage"}, {&Nju, "https://mirror.nju.edu.cn/hackage"}, {&Ustc, "https://mirrors.ustc.edu.cn/hackage"} -}, - - - - -/** - * @time 2023-09-05 更新 - * @note 缺少商业公司或开源社区软件源 - */ -pl_julia_sources[] = { - {&Upstream, NULL}, - {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/julia"}, - {&Pku, "https://mirrors.pku.edu.cn/julia"}, - {&Nju, "https://mirror.nju.edu.cn/julia"} }; @@ -706,7 +692,6 @@ wr_tex_sources[] = { def_sources_n(pl_clojure); def_sources_n(pl_dotnet); def_sources_n(pl_dart); def_sources_n(pl_haskell); -def_sources_n(pl_julia); def_sources_n(os_ubuntu); def_sources_n(os_mint); def_sources_n(os_debian); def_sources_n(os_fedora); diff --git a/src/chsrc.c b/src/chsrc.c index 86bf67b..272ef71 100644 --- a/src/chsrc.c +++ b/src/chsrc.c @@ -177,43 +177,7 @@ pl_haskell_setsrc (char *option) #include "recipe/lang/ocaml.c" #include "recipe/lang/r.c" - - - -/** - * Julia的换源可以通过两种方式 - * 1. 写入 startup.jl - * 2. 使用环境变量 - * - * 我们采用第一种 - */ -void -pl_julia_getsrc (char *option) -{ - chsrc_view_file ("~/.julia/config/startup.jl"); -} - -/** - * Julia 换源,参考: - * 1. https://help.mirrors.cernet.edu.cn/julia/ - * 2. https://docs.julialang.org/en/v1/manual/command-line-interface/#Startup-file - */ -void -pl_julia_setsrc (char *option) -{ - SourceInfo source; - chsrc_yield_source (pl_julia); - chsrc_confirm_source (&source); - - const char *towrite = xy_strjoin (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\""); - - chsrc_append_to_file (towrite, "~/.julia/config/startup.jl"); - chsrc_say_lastly (&source, ChsrcTypeUntested); -} - - - - +#include "recipe/lang/julia.c" diff --git a/src/recipe/catalog.c b/src/recipe/catalog.c index bfdc372..c8a2a6c 100644 --- a/src/recipe/catalog.c +++ b/src/recipe/catalog.c @@ -9,7 +9,6 @@ /* Begin Target Matrix */ def_target(pl_dart); -def_target(pl_julia); def_target_noget (pl_clojure); def_target_noget (pl_dotnet); def_target_noget (pl_haskell); diff --git a/src/recipe/lang/julia.c b/src/recipe/lang/julia.c new file mode 100644 index 0000000..b4d5767 --- /dev/null +++ b/src/recipe/lang/julia.c @@ -0,0 +1,55 @@ +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------- + * File Authors : Aoran Zeng + * Contributors : Nil Null + * Created on : <2023-08-31> + * Last modified : <2024-08-15> + * ------------------------------------------------------------*/ + +/** + * @time 2023-09-05 更新 + * @note 缺少商业公司或开源社区软件源 + */ +static SourceInfo +pl_julia_sources[] = { + {&Upstream, NULL}, + {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/julia"}, + {&Pku, "https://mirrors.pku.edu.cn/julia"}, + {&Nju, "https://mirror.nju.edu.cn/julia"} +}; +def_sources_n(pl_julia); + + +/** + * Julia的换源可以通过两种方式 + * 1. 写入 startup.jl + * 2. 使用环境变量 + * + * 我们采用第一种 + */ +void +pl_julia_getsrc (char *option) +{ + chsrc_view_file ("~/.julia/config/startup.jl"); +} + +/** + * Julia 换源,参考: + * 1. https://help.mirrors.cernet.edu.cn/julia/ + * 2. https://docs.julialang.org/en/v1/manual/command-line-interface/#Startup-file + */ +void +pl_julia_setsrc (char *option) +{ + SourceInfo source; + chsrc_yield_source (pl_julia); + chsrc_confirm_source (&source); + + const char *towrite = xy_strjoin (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\""); + + chsrc_append_to_file (towrite, "~/.julia/config/startup.jl"); + chsrc_say_lastly (&source, ChsrcTypeUntested); +} + +def_target(pl_julia);