Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions install.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package kclvm_artifact

import (
"bytes"
"fmt"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -118,18 +116,6 @@ func InstallKclvmPy(installRoot string) error {
return err
}

// Run KCL CLI to install dependencies.
cmd := exec.Command("kcl")
var errBuf bytes.Buffer
cmd.Stderr = &errBuf
err = cmd.Run()
if errBuf.Len() != 0 {
return fmt.Errorf("%s", errBuf.String())
}
if err != nil {
return err
}

err = os.WriteFile(kclvmVersionPath, []byte(KCLVM_VERSION), os.FileMode(os.O_WRONLY|os.O_TRUNC))
if err != nil {
return err
Expand Down
22 changes: 6 additions & 16 deletions scripts/kcl
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,16 @@
# Stop on error.
set -e

# python3 path
python3_bin=`which python3`
# kclvm_cli path
kclvm_cli_bin=`which kclvm_cli`
kclvm_install_dir=$(cd `dirname $0`/..; pwd)

# check python3
if [ -z "$python3_bin" ]; then
echo "python3 not found!"
# check kclvm_cli
if [ -z "$kclvm_cli_bin" ]; then
echo "kclvm cli not found!"
exit 1
fi

is_kclvm_installed=$($python3_bin -c "import pkgutil; print(bool(pkgutil.find_loader('kclvm')))")
# once: pip install
if [ "$is_kclvm_installed"x = "False"x ]; then
mkdir -pv $kclvm_install_dir/lib/site-packages/
# check python3 version
$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))"
# kclvm pip install all libs
$python3_bin -m pip install kclvm --user -U
fi

export PYTHONPATH=$kclvm_install_dir/lib/site-packages
export KCLVM_CLI_BIN_PATH=$kclvm_install_dir/bin
$python3_bin -m kclvm "$@"
$kclvm_cli_bin run "$@"
7 changes: 3 additions & 4 deletions scripts/kcl-doc
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ if [ -z "$python3_bin" ]; then
exit 1
fi

is_kclvm_installed=$($python3_bin -c "import pkgutil; print(bool(pkgutil.find_loader('kclvm')))")
# once: pip install
if [ "$is_kclvm_installed"x = "False"x ]; then
mkdir -pv $kclvm_install_dir/lib/site-packages/
if [ ! -f $pip_install_done_file ]; then
# check python3 version
$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))"
# kclvm pip install all libs
$python3_bin -m pip install kclvm --user -U
$python3_bin -m pip install -U kclvm --user
echo 'done' > $pip_install_done_file
fi

export PYTHONPATH=$kclvm_install_dir/lib/site-packages
Expand Down
23 changes: 6 additions & 17 deletions scripts/kcl-fmt
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,16 @@
# Stop on error.
set -e

# python3 path
python3_bin=`which python3`
# kclvm_cli path
kclvm_cli_bin=`which kclvm_cli`
kclvm_install_dir=$(cd `dirname $0`/..; pwd)
pip_install_done_file="$kclvm_install_dir/lib/site-packages/kclvm.requirements.done.txt"

# check python3
if [ -z "$python3_bin" ]; then
echo "python3 not found!"
# check kclvm_cli
if [ -z "$kclvm_cli_bin" ]; then
echo "kclvm cli not found!"
exit 1
fi

is_kclvm_installed=$($python3_bin -c "import pkgutil; print(bool(pkgutil.find_loader('kclvm')))")
# once: pip install
if [ "$is_kclvm_installed"x = "False"x ]; then
mkdir -pv $kclvm_install_dir/lib/site-packages/
# check python3 version
$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))"
# kclvm pip install all libs
$python3_bin -m pip install kclvm --user -U
fi

export PYTHONPATH=$kclvm_install_dir/lib/site-packages
export KCLVM_CLI_BIN_PATH=$kclvm_install_dir/bin
$python3_bin -m kclvm.tools.format "$@"
$kclvm_cli_bin fmt "$@"
24 changes: 6 additions & 18 deletions scripts/kcl-lint
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,16 @@
# Stop on error.
set -e

# python3 path
python3_bin=`which python3`
# kclvm_cli path
kclvm_cli_bin=`which kclvm_cli`
kclvm_install_dir=$(cd `dirname $0`/..; pwd)
pip_install_done_file="$kclvm_install_dir/lib/site-packages/kclvm.requirements.done.txt"

# check python3
if [ -z "$python3_bin" ]; then
echo "python3 not found!"
# check kclvm_cli
if [ -z "$kclvm_cli_bin" ]; then
echo "kclvm cli not found!"
exit 1
fi

is_kclvm_installed=$($python3_bin -c "import pkgutil; print(bool(pkgutil.find_loader('kclvm')))")
# once: pip install
if [ "$is_kclvm_installed"x = "False"x ]; then
mkdir -pv $kclvm_install_dir/lib/site-packages/
# check python3 version
$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))"
# kclvm pip install all libs
$python3_bin -m pip install kclvm --user -U
fi

export PYTHONPATH=$kclvm_install_dir/lib/site-packages
export KCLVM_CLI_BIN_PATH=$kclvm_install_dir/bin
$python3_bin -m kclvm.tools.lint "$@"

$kclvm_cli_bin lint "$@"
7 changes: 3 additions & 4 deletions scripts/kcl-plugin
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ if [ -z "$python3_bin" ]; then
exit 1
fi

is_kclvm_installed=$($python3_bin -c "import pkgutil; print(bool(pkgutil.find_loader('kclvm')))")
# once: pip install
if [ "$is_kclvm_installed"x = "False"x ]; then
mkdir -pv $kclvm_install_dir/lib/site-packages/
if [ ! -f $pip_install_done_file ]; then
# check python3 version
$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))"
# kclvm pip install all libs
$python3_bin -m pip install kclvm --user -U
$python3_bin -m pip install -U kclvm --user
echo 'done' > $pip_install_done_file
fi

export PYTHONPATH=$kclvm_install_dir/lib/site-packages
Expand Down
2 changes: 1 addition & 1 deletion scripts/kcl-test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

kcl_go_path=$(cd `dirname $0`; pwd)/kcl-go
if [[ ! -f $kcl_go_path ]]; then
echo "kcl-go not found, please check the installation"
echo "kcl-go not found, please check the installation at https://github.com/KusionStack/kclvm-go"
exit 1
fi
export PYTHONPATH=''
Expand Down
23 changes: 6 additions & 17 deletions scripts/kcl-vet
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,16 @@
# Stop on error.
set -e

# python3 path
python3_bin=`which python3`
# kclvm_cli path
kclvm_cli_bin=`which kclvm_cli`
kclvm_install_dir=$(cd `dirname $0`/..; pwd)
pip_install_done_file="$kclvm_install_dir/lib/site-packages/kclvm.requirements.done.txt"

# check python3
if [ -z "$python3_bin" ]; then
echo "python3 not found!"
# check kclvm_cli
if [ -z "$kclvm_cli_bin" ]; then
echo "kclvm cli not found!"
exit 1
fi

is_kclvm_installed=$($python3_bin -c "import pkgutil; print(bool(pkgutil.find_loader('kclvm')))")
# once: pip install
if [ "$is_kclvm_installed"x = "False"x ]; then
mkdir -pv $kclvm_install_dir/lib/site-packages/
# check python3 version
$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))"
# kclvm pip install all libs
$python3_bin -m pip install kclvm --user -U
fi

export PYTHONPATH=$kclvm_install_dir/lib/site-packages
export KCLVM_CLI_BIN_PATH=$kclvm_install_dir/bin
$python3_bin -m kclvm.tools.validation "$@"
$kclvm_cli_bin vet "$@"
20 changes: 0 additions & 20 deletions scripts/kclvm
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,7 @@
# Stop on error.
set -e

# python3 path
python3_bin=`which python3`
kclvm_install_dir=$(cd `dirname $0`/..; pwd)
pip_install_done_file="$kclvm_install_dir/lib/site-packages/kclvm.requirements.done.txt"

# check python3
if [ -z "$python3_bin" ]; then
echo "python3 not found!"
exit 1
fi

is_kclvm_installed=$($python3_bin -c "import pkgutil; print(bool(pkgutil.find_loader('kclvm')))")
# once: pip install
if [ "$is_kclvm_installed"x = "False"x ]; then
mkdir -pv $kclvm_install_dir/lib/site-packages/
# check python3 version
$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))"
# kclvm pip install all libs
$python3_bin -m pip install kclvm --user -U
fi

export KCLVM_CLI_BIN_PATH=$kclvm_install_dir/bin
export PYTHONPATH=$kclvm_install_dir/lib/site-packages
python3 "$@"