Skip to content

Commit

Permalink
Avoid bash dependency in rayvens-setup.sh (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
tardieu authored Aug 12, 2021
1 parent 20894d7 commit e6a8bf2
Showing 1 changed file with 14 additions and 30 deletions.
44 changes: 14 additions & 30 deletions scripts/rayvens-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ cpu="1"
mem="2G"
project_dir=""
project_requirements_file=""
project_dependencies=()
project_pip_dependencies=()
project_dependencies=""
project_pip_dependencies=""

while [ -n "$1" ]; do
case "$1" in
Expand All @@ -50,8 +50,8 @@ while [ -n "$1" ]; do
--version) version="1";;
--install-project) install_project="1";;
--project-dir) shift; project_dir=$1;;
-d|--project-dep) shift; project_dependencies+=("$1");;
-p|--project-pip-dep) shift; project_pip_dependencies+=("$1");;
-d|--project-dep) shift; project_dependencies="$project_dependencies $1";;
-p|--project-pip-dep) shift; project_pip_dependencies="$project_pip_dependencies $1";;
--project-requirements) shift; project_requirements_file=$1;;
--requirements-in-project-dir) requirements_in_project_dir="1";;

Expand Down Expand Up @@ -409,25 +409,17 @@ EOF
head_setup_commands:
EOF

if [ "${#project_dependencies[@]}" -gt "0" ]; then
if [ -n "$project_dependencies" ]; then
cat >> "$config" << EOF
- sudo apt-get update
- sudo apt-get -y install$project_dependencies
EOF
for dependency in "${project_dependencies[@]}"
do
cat >> "$config" << EOF
- sudo apt-get -y install $dependency
EOF
done
fi

if [ "${#project_pip_dependencies[@]}" -gt "0" ]; then
for pip_dependency in "${project_pip_dependencies[@]}"
do
cat >> "$config" << EOF
- pip install $pip_dependency
if [ -n "$project_pip_dependencies" ]; then
cat >> "$config" << EOF
- pip install$project_pip_dependencies
EOF
done
fi

if [ -n "$requirements_in_project_dir" ]; then
Expand All @@ -450,25 +442,17 @@ EOF
worker_setup_commands:
EOF

if [ "${#project_dependencies[@]}" -gt "0" ]; then
if [ -n "$project_dependencies" ]; then
cat >> "$config" << EOF
- sudo apt-get update
- sudo apt-get -y install$project_dependencies
EOF
for dependency in "${project_dependencies[@]}"
do
cat >> "$config" << EOF
- sudo apt-get -y install $dependency
EOF
done
fi

if [ "${#project_pip_dependencies[@]}" -gt "0" ]; then
for pip_dependency in "${project_pip_dependencies[@]}"
do
cat >> "$config" << EOF
- pip install $pip_dependency
if [ -n "$project_pip_dependencies" ]; then
cat >> "$config" << EOF
- pip install$project_pip_dependencies
EOF
done
fi

if [ -n "$requirements_in_project_dir" ]; then
Expand Down

0 comments on commit e6a8bf2

Please sign in to comment.