File tree Expand file tree Collapse file tree 8 files changed +186
-4
lines changed
Expand file tree Collapse file tree 8 files changed +186
-4
lines changed Original file line number Diff line number Diff line change @@ -26,11 +26,24 @@ func InstallKclvm(installRoot string) error {
2626 os .Setenv ("PATH" , os .Getenv ("PATH" )+ ":" + binPath )
2727
2828 // Run KCL CLI to install dependencies.
29- err = installBin (binPath , "kcl" , kclScript , true )
30- if err != nil {
31- return err
29+ scripts := map [string ][]byte {
30+ "kcl" : kclScript ,
31+ "kclvm" : kclvmScript ,
32+ "kcl-doc" : kclDocScript ,
33+ "kcl-fmt" : kclFmtScript ,
34+ "kcl-lint" : kclLintScript ,
35+ "kcl-plugin" : kclPluginScript ,
36+ "kcl-test" : kclTestScript ,
37+ "kcl-vet" : kclVetScript ,
3238 }
33- err = installBin (binPath , "kclvm" , kclvmScript , false )
39+ for n , script := range scripts {
40+ err := installBin (binPath , n , script , false )
41+ if err != nil {
42+ return err
43+ }
44+ }
45+ // Run KCL CLI to install dependencies.
46+ err = installBin (binPath , "kcl" , kclScript , true )
3447 if err != nil {
3548 return err
3649 }
Original file line number Diff line number Diff line change @@ -9,3 +9,21 @@ var kclScript []byte
99
1010//go:embed scripts/kclvm
1111var kclvmScript []byte
12+
13+ //go:embed scripts/kcl-doc
14+ var kclDocScript []byte
15+
16+ //go:embed scripts/kcl-fmt
17+ var kclFmtScript []byte
18+
19+ //go:embed scripts/kcl-lint
20+ var kclLintScript []byte
21+
22+ //go:embed scripts/kcl-plugin
23+ var kclPluginScript []byte
24+
25+ //go:embed scripts/kcl-test
26+ var kclTestScript []byte
27+
28+ //go:embed scripts/kcl-vet
29+ var kclVetScript []byte
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Stop on error.
4+ set -e
5+
6+ # python3 path
7+ python3_bin=` which python3`
8+ kclvm_install_dir=$( cd ` dirname $0 ` /..; pwd)
9+ pip_install_done_file=" $kclvm_install_dir /lib/site-packages/kclvm.requirements.done.txt"
10+
11+ # check python3
12+ if [ -z " $python3_bin " ]; then
13+ echo " python3 not found!"
14+ exit 1
15+ fi
16+
17+ # once: pip install
18+ if [ ! -f $pip_install_done_file ]; then
19+ # check python3 version
20+ $python3_bin -c " import sys; sys.exit(0) if sys.version_info>=(3,7,3) else (print('please install python 3.7.3+') or sys.exit(1))"
21+ # kclvm pip install all libs
22+ $python3_bin -m pip install kclvm --user
23+ echo ' done' > $pip_install_done_file
24+ fi
25+
26+ export PYTHONPATH=$kclvm_install_dir /lib/site-packages
27+ export KCLVM_CLI_BIN_PATH=$kclvm_install_dir /bin
28+ $python3_bin -m kclvm.tools.docs " $@ "
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Stop on error.
4+ set -e
5+
6+ # python3 path
7+ python3_bin=` which python3`
8+ kclvm_install_dir=$( cd ` dirname $0 ` /..; pwd)
9+ pip_install_done_file=" $kclvm_install_dir /lib/site-packages/kclvm.requirements.done.txt"
10+
11+ # check python3
12+ if [ -z " $python3_bin " ]; then
13+ echo " python3 not found!"
14+ exit 1
15+ fi
16+
17+ # once: pip install
18+ if [ ! -f $pip_install_done_file ]; then
19+ # check python3 version
20+ $python3_bin -c " import sys; sys.exit(0) if sys.version_info>=(3,7,3) else (print('please install python 3.7.3+') or sys.exit(1))"
21+ # kclvm pip install all libs
22+ $python3_bin -m pip install kclvm --user
23+ echo ' done' > $pip_install_done_file
24+ fi
25+
26+ export PYTHONPATH=$kclvm_install_dir /lib/site-packages
27+ export KCLVM_CLI_BIN_PATH=$kclvm_install_dir /bin
28+ $python3_bin -m kclvm.tools.format " $@ "
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Stop on error.
4+ set -e
5+
6+ # python3 path
7+ python3_bin=` which python3`
8+ kclvm_install_dir=$( cd ` dirname $0 ` /..; pwd)
9+ pip_install_done_file=" $kclvm_install_dir /lib/site-packages/kclvm.requirements.done.txt"
10+
11+ # check python3
12+ if [ -z " $python3_bin " ]; then
13+ echo " python3 not found!"
14+ exit 1
15+ fi
16+
17+ # once: pip install
18+ if [ ! -f $pip_install_done_file ]; then
19+ # check python3 version
20+ $python3_bin -c " import sys; sys.exit(0) if sys.version_info>=(3,7,3) else (print('please install python 3.7.3+') or sys.exit(1))"
21+ # kclvm pip install all libs
22+ $python3_bin -m pip install kclvm --user
23+ echo ' done' > $pip_install_done_file
24+ fi
25+
26+ export PYTHONPATH=$kclvm_install_dir /lib/site-packages
27+ export KCLVM_CLI_BIN_PATH=$kclvm_install_dir /bin
28+ $python3_bin -m kclvm.tools.lint " $@ "
29+
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Stop on error.
4+ set -e
5+
6+ # python3 path
7+ python3_bin=` which python3`
8+ kclvm_install_dir=$( cd ` dirname $0 ` /..; pwd)
9+ pip_install_done_file=" $kclvm_install_dir /lib/site-packages/kclvm.requirements.done.txt"
10+
11+ # check python3
12+ if [ -z " $python3_bin " ]; then
13+ echo " python3 not found!"
14+ exit 1
15+ fi
16+
17+ # once: pip install
18+ if [ ! -f $pip_install_done_file ]; then
19+ # check python3 version
20+ $python3_bin -c " import sys; sys.exit(0) if sys.version_info>=(3,7,3) else (print('please install python 3.7.3+') or sys.exit(1))"
21+ # kclvm pip install all libs
22+ $python3_bin -m pip install kclvm --user
23+ echo ' done' > $pip_install_done_file
24+ fi
25+
26+ export PYTHONPATH=$kclvm_install_dir /lib/site-packages
27+ export KCLVM_CLI_BIN_PATH=$kclvm_install_dir /bin
28+ $python3_bin -m kclvm.tools.plugin " $@ "
29+
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ kcl_go_path=$( cd ` dirname $0 ` ; pwd) /kcl-go
4+ if [[ ! -f $kcl_go_path ]]; then
5+ echo " kcl-go not found, please check the installation"
6+ exit 1
7+ fi
8+ export PYTHONPATH=' '
9+ $kcl_go_path test " $@ "
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # Stop on error.
4+ set -e
5+
6+ # python3 path
7+ python3_bin=` which python3`
8+ kclvm_install_dir=$( cd ` dirname $0 ` /..; pwd)
9+ pip_install_done_file=" $kclvm_install_dir /lib/site-packages/kclvm.requirements.done.txt"
10+
11+ # check python3
12+ if [ -z " $python3_bin " ]; then
13+ echo " python3 not found!"
14+ exit 1
15+ fi
16+
17+ # once: pip install
18+ if [ ! -f $pip_install_done_file ]; then
19+ # check python3 version
20+ $python3_bin -c " import sys; sys.exit(0) if sys.version_info>=(3,7,3) else (print('please install python 3.7.3+') or sys.exit(1))"
21+ # kclvm pip install all libs
22+ $python3_bin -m pip install kclvm --user
23+ echo ' done' > $pip_install_done_file
24+ fi
25+
26+ export PYTHONPATH=$kclvm_install_dir /lib/site-packages
27+ export KCLVM_CLI_BIN_PATH=$kclvm_install_dir /bin
28+ $python3_bin -m kclvm.tools.validation " $@ "
You can’t perform that action at this time.
0 commit comments