Skip to content

Adding functionality to auto select the latest, stable version of pyt… #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
13 changes: 12 additions & 1 deletion python/mac-installs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
PYTHON_VERSION=3.10
# Define the Python download URL prefix
PYTHON_DOWNLOAD_URL_PREFIX="https://www.python.org/ftp/python"

# Fetch the list of available Python versions
VERSION_LIST=$(curl -s "$PYTHON_DOWNLOAD_URL_PREFIX/" | grep -oP '(?<=href=")[0-9]+\.[0-9]+\.[0-9]+(?=/")')

# Filter out non-stable versions (e.g., alphas, betas, release candidates)
STABLE_VERSIONS=$(echo "$VERSION_LIST" | grep -E '^[0-9]+\.[0-9]*[02468]\.[0-9]+$')

# Get the latest stable version
LATEST_STABLE_VERSION=$(echo "$STABLE_VERSIONS" | sort -V | tail -n 1)

PYTHON_VERSION=$LATEST_STABLE_VERSION

echo "Installing VS Code Extensions"
code --install-extension ms-python.python --force
Expand Down
14 changes: 13 additions & 1 deletion python/wsl-ubuntu-installs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
PYTHON_VERSION=3.12
# Define the Python download URL prefix
PYTHON_DOWNLOAD_URL_PREFIX="https://www.python.org/ftp/python"

# Fetch the list of available Python versions
VERSION_LIST=$(curl -s "$PYTHON_DOWNLOAD_URL_PREFIX/" | grep -oP '(?<=href=")[0-9]+\.[0-9]+\.[0-9]+(?=/")')

# Filter out non-stable versions (e.g., alphas, betas, release candidates)
STABLE_VERSIONS=$(echo "$VERSION_LIST" | grep -E '^[0-9]+\.[0-9]*[02468]\.[0-9]+$')

# Get the latest stable version
LATEST_STABLE_VERSION=$(echo "$STABLE_VERSIONS" | sort -V | tail -n 1)

PYTHON_VERSION=$LATEST_STABLE_VERSION

echo "Installing VS Code Extensions"
code --install-extension ms-python.python --force
Expand Down