mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-02-23 22:57:23 +08:00
Split anaconda out
This commit is contained in:
parent
a92b30c57b
commit
019b0b060b
@ -153,38 +153,10 @@ pl_dotnet_sources[] = {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @time 2023-09-11 更新
|
||||
* @note 目前只有一个源
|
||||
* @time 2023-09-10 更新
|
||||
*/
|
||||
static SourceInfo
|
||||
wr_flathub_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/flathub"},
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @time 2023-09-10 更新
|
||||
* @note 这些链接将会在setsrc函数中补充完整
|
||||
*/
|
||||
wr_anaconda_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/anaconda/"},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/anaconda/"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/anaconda/"},
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/anaconda"}
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @time 2023-09-10 更新
|
||||
*/
|
||||
wr_tex_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/ctan/systems/texlive/tlnet"},
|
||||
@ -203,6 +175,5 @@ wr_tex_sources[] = {
|
||||
def_sources_n(pl_clojure);
|
||||
def_sources_n(pl_dotnet);
|
||||
|
||||
def_sources_n(wr_flathub);
|
||||
def_sources_n(wr_tex);
|
||||
def_sources_n(wr_anaconda);
|
||||
|
||||
|
81
src/chsrc.c
81
src/chsrc.c
@ -182,86 +182,9 @@ wr_tex_setsrc (char *option)
|
||||
#include "recipe/ware/CocoaPods.c"
|
||||
#include "recipe/ware/Nix.c"
|
||||
#include "recipe/ware/Guix.c"
|
||||
|
||||
|
||||
|
||||
#include "recipe/ware/Flathub.c"
|
||||
#include "recipe/ware/docker.c"
|
||||
|
||||
|
||||
/**
|
||||
* 参考: https://mirrors.sjtug.sjtu.edu.cn/docs/flathub
|
||||
*/
|
||||
void
|
||||
wr_flathub_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_flathub);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
chsrc_note2 ("若出现问题,可先调用以下命令:");
|
||||
char *note = xy_strjoin (3,
|
||||
"wget ", source.url, "/flathub.gpg\n"
|
||||
"flatpak remote-modify --gpg-import=flathub.gpg flathub"
|
||||
);
|
||||
puts (note);
|
||||
|
||||
char *cmd = xy_2strjoin ("flatpak remote-modify flathub --url=", source.url);
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
wr_anaconda_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_anaconda);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
char *main = xy_2strjoin (source.url, "pkgs/main");
|
||||
char *r = xy_2strjoin (source.url, "pkgs/r");
|
||||
char *msys2 = xy_2strjoin (source.url, "pkgs/msys2");
|
||||
char *cloud = xy_2strjoin (source.url, "cloud");
|
||||
|
||||
char *file = xy_strjoin (22,
|
||||
"channels:\n - defaults\n"
|
||||
"show_channel_urls: true\ndefault_channels:"
|
||||
"\n - ", main,
|
||||
"\n - ", r,
|
||||
"\n - ", msys2,
|
||||
"\ncustom_channels:\n"
|
||||
" conda-forge: ", cloud,
|
||||
"\n msys2: ", cloud,
|
||||
"\n bioconda: ", cloud,
|
||||
"\n menpo: ", cloud,
|
||||
"\n pytorch: ", cloud,
|
||||
"\n pytorch-lts: ", cloud,
|
||||
"\n simpleitk: ", cloud,
|
||||
"\n deepmodeling: ", cloud);
|
||||
|
||||
|
||||
// TODO: 待确认 windows 上也是这里吗?
|
||||
char *config = xy_2strjoin (xy_os_home, "/.condarc");
|
||||
|
||||
if (xy_on_windows)
|
||||
{
|
||||
bool exist = chsrc_check_program ("conda");
|
||||
if (!exist)
|
||||
{
|
||||
chsrc_error ("未找到 conda 命令,请检查是否存在");
|
||||
exit (Exit_UserCause);
|
||||
}
|
||||
chsrc_run ("conda config --set show_channel_urls yes", RunOpt_Default);
|
||||
}
|
||||
|
||||
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
|
||||
puts (file);
|
||||
|
||||
chsrc_note2 ("然后运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引");
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
#include "recipe/ware/Anaconda.c"
|
||||
|
||||
|
||||
#include "recipe/catalog.c"
|
||||
|
@ -91,9 +91,6 @@ static const char
|
||||
os_freebsd, os_netbsd, os_openbsd,
|
||||
};
|
||||
|
||||
|
||||
def_target_noget (wr_flathub);
|
||||
def_target_noget (wr_anaconda);
|
||||
def_target(wr_tex);
|
||||
|
||||
static const char
|
||||
|
75
src/recipe/ware/Anaconda.c
Normal file
75
src/recipe/ware/Anaconda.c
Normal file
@ -0,0 +1,75 @@
|
||||
/** ------------------------------------------------------------
|
||||
* 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-10>
|
||||
* Last Modified : <2024-08-15>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @time 2023-09-10 更新
|
||||
* @note 这些链接将会在setsrc函数中补充完整
|
||||
*/
|
||||
static SourceInfo
|
||||
wr_anaconda_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/anaconda/"},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/anaconda/"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/anaconda/"},
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/anaconda"}
|
||||
};
|
||||
def_sources_n(wr_anaconda);
|
||||
|
||||
|
||||
void
|
||||
wr_anaconda_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_anaconda);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
char *main = xy_2strjoin (source.url, "pkgs/main");
|
||||
char *r = xy_2strjoin (source.url, "pkgs/r");
|
||||
char *msys2 = xy_2strjoin (source.url, "pkgs/msys2");
|
||||
char *cloud = xy_2strjoin (source.url, "cloud");
|
||||
|
||||
char *file = xy_strjoin (22,
|
||||
"channels:\n - defaults\n"
|
||||
"show_channel_urls: true\ndefault_channels:"
|
||||
"\n - ", main,
|
||||
"\n - ", r,
|
||||
"\n - ", msys2,
|
||||
"\ncustom_channels:\n"
|
||||
" conda-forge: ", cloud,
|
||||
"\n msys2: ", cloud,
|
||||
"\n bioconda: ", cloud,
|
||||
"\n menpo: ", cloud,
|
||||
"\n pytorch: ", cloud,
|
||||
"\n pytorch-lts: ", cloud,
|
||||
"\n simpleitk: ", cloud,
|
||||
"\n deepmodeling: ", cloud);
|
||||
|
||||
|
||||
// TODO: 待确认 windows 上也是这里吗?
|
||||
char *config = xy_2strjoin (xy_os_home, "/.condarc");
|
||||
|
||||
if (xy_on_windows)
|
||||
{
|
||||
bool exist = chsrc_check_program ("conda");
|
||||
if (!exist)
|
||||
{
|
||||
chsrc_error ("未找到 conda 命令,请检查是否存在");
|
||||
exit (Exit_UserCause);
|
||||
}
|
||||
chsrc_run ("conda config --set show_channel_urls yes", RunOpt_Default);
|
||||
}
|
||||
|
||||
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
|
||||
puts (file);
|
||||
|
||||
chsrc_note2 ("然后运行 conda clean -i 清除索引缓存,保证用的是镜像站提供的索引");
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
def_target_noget (wr_anaconda);
|
45
src/recipe/ware/Flathub.c
Normal file
45
src/recipe/ware/Flathub.c
Normal file
@ -0,0 +1,45 @@
|
||||
/** ------------------------------------------------------------
|
||||
* 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-11>
|
||||
* Last Modified : <2024-08-15>
|
||||
* ------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @time 2023-09-11 更新
|
||||
* @note 目前只有一个源
|
||||
*/
|
||||
static SourceInfo
|
||||
wr_flathub_sources[] = {
|
||||
{&Upstream, NULL},
|
||||
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/flathub"},
|
||||
};
|
||||
def_sources_n(wr_flathub);
|
||||
|
||||
|
||||
/**
|
||||
* 参考: https://mirrors.sjtug.sjtu.edu.cn/docs/flathub
|
||||
*/
|
||||
void
|
||||
wr_flathub_setsrc (char *option)
|
||||
{
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (wr_flathub);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
chsrc_note2 ("若出现问题,可先调用以下命令:");
|
||||
char *note = xy_strjoin (3,
|
||||
"wget ", source.url, "/flathub.gpg\n"
|
||||
"flatpak remote-modify --gpg-import=flathub.gpg flathub"
|
||||
);
|
||||
puts (note);
|
||||
|
||||
char *cmd = xy_2strjoin ("flatpak remote-modify flathub --url=", source.url);
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
||||
def_target_noget (wr_flathub);
|
Loading…
x
Reference in New Issue
Block a user