Skip to content

Commit 0b47c18

Browse files
authored
Merge pull request #15 from Peefy/update-unix-scripts
chore: bump unix scripts and remove python3 in scripts.
2 parents 686db18 + cf52163 commit 0b47c18

File tree

9 files changed

+31
-111
lines changed

9 files changed

+31
-111
lines changed

install.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package kclvm_artifact
22

33
import (
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

scripts/kcl

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,16 @@
33
# Stop on error.
44
set -e
55

6-
# python3 path
7-
python3_bin=`which python3`
6+
# kclvm_cli path
7+
kclvm_cli_bin=`which kclvm_cli`
88
kclvm_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
1414
fi
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-
2616
export PYTHONPATH=$kclvm_install_dir/lib/site-packages
2717
export KCLVM_CLI_BIN_PATH=$kclvm_install_dir/bin
28-
$python3_bin -m kclvm "$@"
18+
$kclvm_cli_bin run "$@"

scripts/kcl-doc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ if [ -z "$python3_bin" ]; then
1414
exit 1
1515
fi
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
2524
fi
2625

2726
export PYTHONPATH=$kclvm_install_dir/lib/site-packages

scripts/kcl-fmt

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,16 @@
33
# Stop on error.
44
set -e
55

6-
# python3 path
7-
python3_bin=`which python3`
6+
# kclvm_cli path
7+
kclvm_cli_bin=`which kclvm_cli`
88
kclvm_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
1514
fi
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-
2716
export PYTHONPATH=$kclvm_install_dir/lib/site-packages
2817
export KCLVM_CLI_BIN_PATH=$kclvm_install_dir/bin
29-
$python3_bin -m kclvm.tools.format "$@"
18+
$kclvm_cli_bin fmt "$@"

scripts/kcl-lint

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,16 @@
33
# Stop on error.
44
set -e
55

6-
# python3 path
7-
python3_bin=`which python3`
6+
# kclvm_cli path
7+
kclvm_cli_bin=`which kclvm_cli`
88
kclvm_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
1514
fi
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-
2716
export PYTHONPATH=$kclvm_install_dir/lib/site-packages
2817
export KCLVM_CLI_BIN_PATH=$kclvm_install_dir/bin
29-
$python3_bin -m kclvm.tools.lint "$@"
30-
18+
$kclvm_cli_bin lint "$@"

scripts/kcl-plugin

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ if [ -z "$python3_bin" ]; then
1414
exit 1
1515
fi
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
2524
fi
2625

2726
export PYTHONPATH=$kclvm_install_dir/lib/site-packages

scripts/kcl-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
kcl_go_path=$(cd `dirname $0`; pwd)/kcl-go
44
if [[ ! -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
77
fi
88
export PYTHONPATH=''

scripts/kcl-vet

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,16 @@
33
# Stop on error.
44
set -e
55

6-
# python3 path
7-
python3_bin=`which python3`
6+
# kclvm_cli path
7+
kclvm_cli_bin=`which kclvm_cli`
88
kclvm_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
1514
fi
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-
2716
export PYTHONPATH=$kclvm_install_dir/lib/site-packages
2817
export KCLVM_CLI_BIN_PATH=$kclvm_install_dir/bin
29-
$python3_bin -m kclvm.tools.validation "$@"
18+
$kclvm_cli_bin vet "$@"

scripts/kclvm

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,7 @@
33
# Stop on error.
44
set -e
55

6-
# python3 path
7-
python3_bin=`which python3`
86
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-
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-
277
export KCLVM_CLI_BIN_PATH=$kclvm_install_dir/bin
288
export PYTHONPATH=$kclvm_install_dir/lib/site-packages
299
python3 "$@"

0 commit comments

Comments
 (0)