From fa3265becf0e67b2fa0843934f0e212dee9c6167 Mon Sep 17 00:00:00 2001 From: Andrey Anshin Date: Fri, 22 Mar 2024 12:54:34 +0400 Subject: [PATCH] doc: Use sys.version_info for determine Python Major.Minor (#38372) --- docs/apache-airflow/installation/installing-from-pypi.rst | 6 +++--- docs/apache-airflow/start.rst | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/apache-airflow/installation/installing-from-pypi.rst b/docs/apache-airflow/installation/installing-from-pypi.rst index 6c379f6639d38..bd4ecbcbe10e5 100644 --- a/docs/apache-airflow/installation/installing-from-pypi.rst +++ b/docs/apache-airflow/installation/installing-from-pypi.rst @@ -249,7 +249,7 @@ a one-liner (the example below installs Postgres and Google providers, as well a :substitutions: AIRFLOW_VERSION=|version| - PYTHON_VERSION="$(python --version | cut -d " " -f 2 | cut -d "." -f 1-2)" + PYTHON_VERSION="$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')" CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt" pip install "apache-airflow[async,postgres,google]==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}" @@ -268,7 +268,7 @@ released and tested together when the version of Airflow you are installing was :substitutions: AIRFLOW_VERSION=|version| - PYTHON_VERSION="$(python --version | cut -d " " -f 2 | cut -d "." -f 1-2)" + PYTHON_VERSION="$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')" CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt" pip install "apache-airflow[postgres,google]==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}" @@ -324,7 +324,7 @@ dependencies compatible with just airflow core at the moment Airflow was release :substitutions: AIRFLOW_VERSION=|version| - PYTHON_VERSION="$(python --version | cut -d " " -f 2 | cut -d "." -f 1-2)" + PYTHON_VERSION="$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')" # For example: 3.8 CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-no-providers-${PYTHON_VERSION}.txt" # For example: https://raw.githubusercontent.com/apache/airflow/constraints-|version|/constraints-no-providers-3.8.txt diff --git a/docs/apache-airflow/start.rst b/docs/apache-airflow/start.rst index ff2229b106621..e7d62f6acf6b7 100644 --- a/docs/apache-airflow/start.rst +++ b/docs/apache-airflow/start.rst @@ -62,7 +62,7 @@ constraint files to enable reproducible installation, so using ``pip`` and const # Extract the version of Python you have installed. If you're currently using a Python version that is not supported by Airflow, you may want to set this manually. # See above for supported versions. - PYTHON_VERSION="$(python --version | cut -d " " -f 2 | cut -d "." -f 1-2)" + PYTHON_VERSION="$(python -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')" CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt" # For example this would install |version| with python 3.8: https://raw.githubusercontent.com/apache/airflow/constraints-|version|/constraints-3.8.txt