Skip to content

Commit

Permalink
get python version from pyproject.toml if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaSchlichting committed Aug 27, 2024
1 parent 15434ff commit 19bca44
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions jo.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
#!/usr/bin/env bash
JOSH_VERSION=0.0.8
JOSH_VERSION=0.0.9
PRE_POETRY_INSTALL_DOCKERFILE_COMMANDS=$(cat << "EOF"
EOF
)

ADDITIONAL_APT_PACKAGES="git g++ make"

CONTAINER_NAME=$(basename "$(pwd)")
PYTHON_IMAGE_VERSION=3.10

read_toml_value() {
local file=$1
local key=$2
local value

# Use awk to extract the value
value=$(awk -F' = ' -v key="$key" '$1 == key {gsub(/"/, "", $2); print $2}' "$file")

# Remove any non-numeric characters except dots
value=$(echo "$value" | sed 's/[^0-9.]//g')

# Return the value
echo "$value"
}
PYPROJECT_PYTHON_VERSION=$(read_toml_value "pyproject.toml" "python")
if [ -z "$PYPROJECT_PYTHON_VERSION" ]; then
PYTHON_IMAGE_VERSION=3.10
else
PYTHON_IMAGE_VERSION=$PYPROJECT_PYTHON_VERSION
fi
INSTALL_PATH=/usr/local/bin/jo.sh
SYMLINK_PATH=/usr/local/bin/josh
CONFIG_DOCKER_COMMANDS_FILE=~/.config/josh/dockerfile_commands
Expand Down

0 comments on commit 19bca44

Please sign in to comment.