File tree Expand file tree Collapse file tree 9 files changed +31
-111
lines changed
Expand file tree Collapse file tree 9 files changed +31
-111
lines changed Original file line number Diff line number Diff line change 11package kclvm_artifact
22
33import (
4- "bytes"
5- "fmt"
64 "os"
75 "os/exec"
86 "path/filepath"
@@ -118,18 +116,6 @@ func InstallKclvmPy(installRoot string) error {
118116 return err
119117 }
120118
121- // Run KCL CLI to install dependencies.
122- cmd := exec .Command ("kcl" )
123- var errBuf bytes.Buffer
124- cmd .Stderr = & errBuf
125- err = cmd .Run ()
126- if errBuf .Len () != 0 {
127- return fmt .Errorf ("%s" , errBuf .String ())
128- }
129- if err != nil {
130- return err
131- }
132-
133119 err = os .WriteFile (kclvmVersionPath , []byte (KCLVM_VERSION ), os .FileMode (os .O_WRONLY | os .O_TRUNC ))
134120 if err != nil {
135121 return err
Original file line number Diff line number Diff line change 33# Stop on error.
44set -e
55
6- # python3 path
7- python3_bin =` which python3 `
6+ # kclvm_cli path
7+ kclvm_cli_bin =` which kclvm_cli `
88kclvm_install_dir=$( cd ` dirname $0 ` /..; pwd)
99
10- # check python3
11- if [ -z " $python3_bin " ]; then
12- echo " python3 not found!"
10+ # check kclvm_cli
11+ if [ -z " $kclvm_cli_bin " ]; then
12+ echo " kclvm cli not found!"
1313 exit 1
1414fi
1515
16- is_kclvm_installed=$( $python3_bin -c " import pkgutil; print(bool(pkgutil.find_loader('kclvm')))" )
17- # once: pip install
18- if [ " $is_kclvm_installed " x = " False" x ]; then
19- mkdir -pv $kclvm_install_dir /lib/site-packages/
20- # check python3 version
21- $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))"
22- # kclvm pip install all libs
23- $python3_bin -m pip install kclvm --user -U
24- fi
25-
2616export PYTHONPATH=$kclvm_install_dir /lib/site-packages
2717export KCLVM_CLI_BIN_PATH=$kclvm_install_dir /bin
28- $python3_bin -m kclvm " $@ "
18+ $kclvm_cli_bin run " $@ "
Original file line number Diff line number Diff line change @@ -14,14 +14,13 @@ if [ -z "$python3_bin" ]; then
1414 exit 1
1515fi
1616
17- is_kclvm_installed=$( $python3_bin -c " import pkgutil; print(bool(pkgutil.find_loader('kclvm')))" )
1817# once: pip install
19- if [ " $is_kclvm_installed " x = " False" x ]; then
20- mkdir -pv $kclvm_install_dir /lib/site-packages/
18+ if [ ! -f $pip_install_done_file ]; then
2119 # check python3 version
2220 $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))"
2321 # kclvm pip install all libs
24- $python3_bin -m pip install kclvm --user -U
22+ $python3_bin -m pip install -U kclvm --user
23+ echo ' done' > $pip_install_done_file
2524fi
2625
2726export PYTHONPATH=$kclvm_install_dir /lib/site-packages
Original file line number Diff line number Diff line change 33# Stop on error.
44set -e
55
6- # python3 path
7- python3_bin =` which python3 `
6+ # kclvm_cli path
7+ kclvm_cli_bin =` which kclvm_cli `
88kclvm_install_dir=$( cd ` dirname $0 ` /..; pwd)
9- pip_install_done_file=" $kclvm_install_dir /lib/site-packages/kclvm.requirements.done.txt"
109
11- # check python3
12- if [ -z " $python3_bin " ]; then
13- echo " python3 not found!"
10+ # check kclvm_cli
11+ if [ -z " $kclvm_cli_bin " ]; then
12+ echo " kclvm cli not found!"
1413 exit 1
1514fi
1615
17- is_kclvm_installed=$( $python3_bin -c " import pkgutil; print(bool(pkgutil.find_loader('kclvm')))" )
18- # once: pip install
19- if [ " $is_kclvm_installed " x = " False" x ]; then
20- mkdir -pv $kclvm_install_dir /lib/site-packages/
21- # check python3 version
22- $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))"
23- # kclvm pip install all libs
24- $python3_bin -m pip install kclvm --user -U
25- fi
26-
2716export PYTHONPATH=$kclvm_install_dir /lib/site-packages
2817export KCLVM_CLI_BIN_PATH=$kclvm_install_dir /bin
29- $python3_bin -m kclvm.tools.format " $@ "
18+ $kclvm_cli_bin fmt " $@ "
Original file line number Diff line number Diff line change 33# Stop on error.
44set -e
55
6- # python3 path
7- python3_bin =` which python3 `
6+ # kclvm_cli path
7+ kclvm_cli_bin =` which kclvm_cli `
88kclvm_install_dir=$( cd ` dirname $0 ` /..; pwd)
9- pip_install_done_file=" $kclvm_install_dir /lib/site-packages/kclvm.requirements.done.txt"
109
11- # check python3
12- if [ -z " $python3_bin " ]; then
13- echo " python3 not found!"
10+ # check kclvm_cli
11+ if [ -z " $kclvm_cli_bin " ]; then
12+ echo " kclvm cli not found!"
1413 exit 1
1514fi
1615
17- is_kclvm_installed=$( $python3_bin -c " import pkgutil; print(bool(pkgutil.find_loader('kclvm')))" )
18- # once: pip install
19- if [ " $is_kclvm_installed " x = " False" x ]; then
20- mkdir -pv $kclvm_install_dir /lib/site-packages/
21- # check python3 version
22- $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))"
23- # kclvm pip install all libs
24- $python3_bin -m pip install kclvm --user -U
25- fi
26-
2716export PYTHONPATH=$kclvm_install_dir /lib/site-packages
2817export KCLVM_CLI_BIN_PATH=$kclvm_install_dir /bin
29- $python3_bin -m kclvm.tools.lint " $@ "
30-
18+ $kclvm_cli_bin lint " $@ "
Original file line number Diff line number Diff line change @@ -14,14 +14,13 @@ if [ -z "$python3_bin" ]; then
1414 exit 1
1515fi
1616
17- is_kclvm_installed=$( $python3_bin -c " import pkgutil; print(bool(pkgutil.find_loader('kclvm')))" )
1817# once: pip install
19- if [ " $is_kclvm_installed " x = " False" x ]; then
20- mkdir -pv $kclvm_install_dir /lib/site-packages/
18+ if [ ! -f $pip_install_done_file ]; then
2119 # check python3 version
2220 $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))"
2321 # kclvm pip install all libs
24- $python3_bin -m pip install kclvm --user -U
22+ $python3_bin -m pip install -U kclvm --user
23+ echo ' done' > $pip_install_done_file
2524fi
2625
2726export PYTHONPATH=$kclvm_install_dir /lib/site-packages
Original file line number Diff line number Diff line change 22
33kcl_go_path=$( cd ` dirname $0 ` ; pwd) /kcl-go
44if [[ ! -f $kcl_go_path ]]; then
5- echo " kcl-go not found, please check the installation"
5+ echo " kcl-go not found, please check the installation at https://github.com/KusionStack/kclvm-go "
66 exit 1
77fi
88export PYTHONPATH=' '
Original file line number Diff line number Diff line change 33# Stop on error.
44set -e
55
6- # python3 path
7- python3_bin =` which python3 `
6+ # kclvm_cli path
7+ kclvm_cli_bin =` which kclvm_cli `
88kclvm_install_dir=$( cd ` dirname $0 ` /..; pwd)
9- pip_install_done_file=" $kclvm_install_dir /lib/site-packages/kclvm.requirements.done.txt"
109
11- # check python3
12- if [ -z " $python3_bin " ]; then
13- echo " python3 not found!"
10+ # check kclvm_cli
11+ if [ -z " $kclvm_cli_bin " ]; then
12+ echo " kclvm cli not found!"
1413 exit 1
1514fi
1615
17- is_kclvm_installed=$( $python3_bin -c " import pkgutil; print(bool(pkgutil.find_loader('kclvm')))" )
18- # once: pip install
19- if [ " $is_kclvm_installed " x = " False" x ]; then
20- mkdir -pv $kclvm_install_dir /lib/site-packages/
21- # check python3 version
22- $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))"
23- # kclvm pip install all libs
24- $python3_bin -m pip install kclvm --user -U
25- fi
26-
2716export PYTHONPATH=$kclvm_install_dir /lib/site-packages
2817export KCLVM_CLI_BIN_PATH=$kclvm_install_dir /bin
29- $python3_bin -m kclvm.tools.validation " $@ "
18+ $kclvm_cli_bin vet " $@ "
Original file line number Diff line number Diff line change 33# Stop on error.
44set -e
55
6- # python3 path
7- python3_bin=` which python3`
86kclvm_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- is_kclvm_installed=$( $python3_bin -c " import pkgutil; print(bool(pkgutil.find_loader('kclvm')))" )
18- # once: pip install
19- if [ " $is_kclvm_installed " x = " False" x ]; then
20- mkdir -pv $kclvm_install_dir /lib/site-packages/
21- # check python3 version
22- $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))"
23- # kclvm pip install all libs
24- $python3_bin -m pip install kclvm --user -U
25- fi
26-
277export KCLVM_CLI_BIN_PATH=$kclvm_install_dir /bin
288export PYTHONPATH=$kclvm_install_dir /lib/site-packages
299python3 " $@ "
You can’t perform that action at this time.
0 commit comments