From b56b063dd5c153b8df4b4ece2e0db6710376aa1d Mon Sep 17 00:00:00 2001 From: Casey Faist <caseylfaist@gmail.com> Date: Fri, 5 Oct 2018 11:49:01 -0500 Subject: [PATCH] add SLUGIFY_USES_TEXT_UNIDECODE support --- CHANGELOG.md | 7 ++++++- bin/steps/pip-install | 16 +++++++++++++++- bin/steps/pipenv | 14 +++++++++++++- test/fixtures/airflow/.env | 1 + test/fixtures/airflow/requirements.txt | 1 + 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 test/fixtures/airflow/.env create mode 100644 test/fixtures/airflow/requirements.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 61476ff8..108a0eab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Python Buildpack Changelog -# 139 +# 140 (2018-10-09) + +Add support for detecting SLUGIFY_USES_TEXT_UNIDECODE, which is required to +install Apache Airflow version 1.10 or higher. + +# 139 (2018-10-08) Improvements to Python install messaging diff --git a/bin/steps/pip-install b/bin/steps/pip-install index 1589d87f..5de8e3db 100755 --- a/bin/steps/pip-install +++ b/bin/steps/pip-install @@ -8,10 +8,24 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then # Install dependencies with Pip. puts-step "Installing requirements with pip" - # Set PIP_EXTRA_INDEX_URL + # Set Pip env vars + # This reads certain environment variables set on the Heroku app config + # and makes them accessible to the pip install process. + # + # PIP_EXTRA_INDEX_URL allows for an alternate pypi URL to be used. if [[ -r $ENV_DIR/PIP_EXTRA_INDEX_URL ]]; then PIP_EXTRA_INDEX_URL="$(cat "$ENV_DIR/PIP_EXTRA_INDEX_URL")" export PIP_EXTRA_INDEX_URL + mcount "buildvar.PIP_EXTRA_INDEX_URL" + fi + + set +e + + # Set SLUGIFY_USES_TEXT_UNIDECODE, required for Airflow versions >=1.10 + if [[ -r $ENV_DIR/SLUGIFY_USES_TEXT_UNIDECODE ]]; then + SLUGIFY_USES_TEXT_UNIDECODE="$(cat "$ENV_DIR/SLUGIFY_USES_TEXT_UNIDECODE")" + export SLUGIFY_USES_TEXT_UNIDECODE + mcount "buildvar.SLUGIFY_USES_TEXT_UNIDECODE" fi set +e diff --git a/bin/steps/pipenv b/bin/steps/pipenv index 38ddf04a..31b479ba 100755 --- a/bin/steps/pipenv +++ b/bin/steps/pipenv @@ -35,10 +35,22 @@ if [ ! "$SKIP_PIPENV_INSTALL" ]; then # Skip pip install, later. export SKIP_PIP_INSTALL=1 - # Set PIP_EXTRA_INDEX_URL + # Set Pip env vars + # This reads certain environment variables set on the Heroku app config + # and makes them accessible to the pip install process. + # + # PIP_EXTRA_INDEX_URL allows for an alternate pypi URL to be used. if [[ -r $ENV_DIR/PIP_EXTRA_INDEX_URL ]]; then PIP_EXTRA_INDEX_URL="$(cat "$ENV_DIR/PIP_EXTRA_INDEX_URL")" export PIP_EXTRA_INDEX_URL + mcount "buildvar.PIP_EXTRA_INDEX_URL" + fi + + # Set SLUGIFY_USES_TEXT_UNIDECODE, required for Airflow versions >=1.10 + if [[ -r $ENV_DIR/SLUGIFY_USES_TEXT_UNIDECODE ]]; then + SLUGIFY_USES_TEXT_UNIDECODE="$(cat "$ENV_DIR/SLUGIFY_USES_TEXT_UNIDECODE")" + export SLUGIFY_USES_TEXT_UNIDECODE + mcount "buildvar.SLUGIFY_USES_TEXT_UNIDECODE" fi export PIPENV_VERSION="2018.5.18" diff --git a/test/fixtures/airflow/.env b/test/fixtures/airflow/.env new file mode 100644 index 00000000..11315273 --- /dev/null +++ b/test/fixtures/airflow/.env @@ -0,0 +1 @@ +SLUGIFY_USES_TEXT_UNIDECODE=yes diff --git a/test/fixtures/airflow/requirements.txt b/test/fixtures/airflow/requirements.txt new file mode 100644 index 00000000..f59ffb95 --- /dev/null +++ b/test/fixtures/airflow/requirements.txt @@ -0,0 +1 @@ +apache-airflow==1.10 -- GitLab