Update setup.sh to make sure the poetry / python checks are referenced in the main (#119)
This commit is contained in:
23
setup.sh
23
setup.sh
@@ -12,13 +12,15 @@ command_exists() {
|
|||||||
command -v "$1" &> /dev/null
|
command -v "$1" &> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Ensure required commands are available
|
ensure_required_commands() {
|
||||||
for cmd in poetry python3.11; do
|
# Ensure required commands are available
|
||||||
if ! command_exists "$cmd"; then
|
for cmd in poetry do
|
||||||
echo "Error: $cmd is not installed." >&2
|
if ! command_exists "$cmd"; then
|
||||||
exit 1
|
echo "Error: $cmd is not installed." >&2
|
||||||
fi
|
exit 1
|
||||||
done
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Function to update or add environment variable in .env file
|
# Function to update or add environment variable in .env file
|
||||||
update_or_add_env_var() {
|
update_or_add_env_var() {
|
||||||
@@ -152,7 +154,11 @@ remove_poetry_env() {
|
|||||||
|
|
||||||
# Choose python version
|
# Choose python version
|
||||||
choose_python_version_or_fail() {
|
choose_python_version_or_fail() {
|
||||||
poetry env use python3.11 || { echo "Error: Python 3.11 is not installed."; exit 1; }
|
# https://github.com/python-poetry/poetry/issues/2117
|
||||||
|
# Py --list-paths
|
||||||
|
# This will output which paths are being used for Python 3.11
|
||||||
|
# Windows users need to poetry env use {{ Py --list-paths with 3.11}}
|
||||||
|
poetry env use python3.11 || { echo "Error: Python 3.11 is not installed. If you're on Windows, check out https://github.com/python-poetry/poetry/issues/2117 to unblock yourself"; exit 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -256,6 +262,7 @@ create_organization() {
|
|||||||
|
|
||||||
# Main function
|
# Main function
|
||||||
main() {
|
main() {
|
||||||
|
ensure_required_commands
|
||||||
initialize_env_file
|
initialize_env_file
|
||||||
choose_python_version_or_fail
|
choose_python_version_or_fail
|
||||||
remove_poetry_env
|
remove_poetry_env
|
||||||
|
|||||||
Reference in New Issue
Block a user