Split r out

This commit is contained in:
Aoran Zeng 2024-08-15 21:04:49 +08:00
parent 79e7296b63
commit 4a8a3dcb9a
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
4 changed files with 82 additions and 68 deletions

View File

@ -186,24 +186,6 @@ pl_haskell_sources[] = {
/**
* @time 2023-09-04
* @note {
* bioconductor的镜像站
* cran的同时bioconductor
* }
*/
pl_r_sources[] = {
{&Upstream, NULL},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/cran/"},
// {&Ali, "https://mirrors.aliyun.com/CRAN/"},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CRAN/"},
// {&Sustech, "https://mirrors.sustech.edu.cn/CRAN"},
// {&Bfsu, "https://mirrors.bfsu.edu.cn/CRAN/"},
// {&Bjtu, "https://mirror.bjtu.edu.cn/cran/"},
},
/**
* @time 2023-09-05
* @note
@ -724,7 +706,7 @@ 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_r); def_sources_n(pl_julia);
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);

View File

@ -176,54 +176,7 @@ pl_haskell_setsrc (char *option)
#include "recipe/lang/ocaml.c"
void
pl_r_getsrc (char *option)
{
// 或参考https://zhuanlan.zhihu.com/p/585036231
//
// options()$repos
// options()$BioC_mirror
//
if (xy_on_windows)
{
chsrc_view_file ("~/Documents/.Rprofile");
}
else
{
chsrc_view_file ("~/.Rprofile");
}
}
/**
* R https://help.mirrors.cernet.edu.cn/CRAN/
*/
void
pl_r_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (pl_r);
chsrc_confirm_source (&source);
char *bioconductor_url = xy_str_delete_suffix (xy_str_delete_suffix (source.url, "cran/"), "CRAN/");
bioconductor_url = xy_2strjoin(bioconductor_url, "bioconductor");
const char *towrite1 = xy_strjoin (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))" );
const char *towrite2 = xy_strjoin (3, "options(BioC_mirror=\"", bioconductor_url, "\")" );
// 或者我们调用 r.exe --slave -e 上面的内容
if (xy_on_windows)
{
chsrc_append_to_file (towrite1, "~/Documents/.Rprofile");
chsrc_append_to_file (towrite2, "~/Documents/.Rprofile");
}
else
{
chsrc_append_to_file (towrite1, "~/.Rprofile");
chsrc_append_to_file (towrite2, "~/.Rprofile");
}
chsrc_say_lastly (&source, ChsrcTypeAuto);
}
#include "recipe/lang/r.c"

View File

@ -9,7 +9,7 @@
/* Begin Target Matrix */
def_target(pl_dart);
def_target(pl_r); def_target(pl_julia);
def_target(pl_julia);
def_target_noget (pl_clojure);
def_target_noget (pl_dotnet);
def_target_noget (pl_haskell);

79
src/recipe/lang/r.c Normal file
View File

@ -0,0 +1,79 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* Created on : <2023-09-21>
* Last modified : <2024-08-15>
* ------------------------------------------------------------*/
/**
* @time 2023-09-04
* @note {
* bioconductor的镜像站
* cran的同时bioconductor
* }
*/
static SourceInfo
pl_r_sources[] = {
{&Upstream, NULL},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/cran/"},
// {&Ali, "https://mirrors.aliyun.com/CRAN/"},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CRAN/"},
// {&Sustech, "https://mirrors.sustech.edu.cn/CRAN"},
// {&Bfsu, "https://mirrors.bfsu.edu.cn/CRAN/"},
// {&Bjtu, "https://mirror.bjtu.edu.cn/cran/"},
};
def_sources_n(pl_r);
void
pl_r_getsrc (char *option)
{
/**
* https://zhuanlan.zhihu.com/p/585036231
*
* options()$repos
* options()$BioC_mirror
*/
if (xy_on_windows)
{
chsrc_view_file ("~/Documents/.Rprofile");
}
else
{
chsrc_view_file ("~/.Rprofile");
}
}
/**
* R https://help.mirrors.cernet.edu.cn/CRAN/
*/
void
pl_r_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (pl_r);
chsrc_confirm_source (&source);
char *bioconductor_url = xy_str_delete_suffix (xy_str_delete_suffix (source.url, "cran/"), "CRAN/");
bioconductor_url = xy_2strjoin(bioconductor_url, "bioconductor");
const char *towrite1 = xy_strjoin (3, "options(\"repos\" = c(CRAN=\"", source.url, "\"))" );
const char *towrite2 = xy_strjoin (3, "options(BioC_mirror=\"", bioconductor_url, "\")" );
// 或者我们调用 r.exe --slave -e 上面的内容
if (xy_on_windows)
{
chsrc_append_to_file (towrite1, "~/Documents/.Rprofile");
chsrc_append_to_file (towrite2, "~/Documents/.Rprofile");
}
else
{
chsrc_append_to_file (towrite1, "~/.Rprofile");
chsrc_append_to_file (towrite2, "~/.Rprofile");
}
chsrc_say_lastly (&source, ChsrcTypeAuto);
}
def_target(pl_r);