From 1ebc88caf236315da9cae984ff815bd3e8e93a50 Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Fri, 5 May 2023 20:40:05 +0530 Subject: [PATCH] fix: build vercel python from source (#7972) --- docs-website/vercel-setup.sh | 31 +++++++++++++++++++ .../airflow-plugin/build.gradle | 2 +- metadata-ingestion/scripts/install_deps.sh | 4 ++- vercel.json | 2 +- 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100755 docs-website/vercel-setup.sh diff --git a/docs-website/vercel-setup.sh b/docs-website/vercel-setup.sh new file mode 100755 index 0000000000..db532e167b --- /dev/null +++ b/docs-website/vercel-setup.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -euxo pipefail + +./metadata-ingestion/scripts/install_deps.sh + +# Build python from source. +# Amazon Linux 2 has Python 3.8, but it's version of OpenSSL is super old and hence it +# doesn't work with the packages we use. As such, we have to build Python from source. +# TODO: This process is extremely slow - ideally we should cache the built Python binary +# for reuse. + +yum groupinstall "Development Tools" -y +yum erase openssl-devel -y +yum install openssl11 openssl11-devel libffi-devel bzip2-devel wget -y + +wget https://www.python.org/ftp/python/3.10.11/Python-3.10.11.tgz +tar -xf Python-3.10.11.tgz +cd Python-3.10.11 +./configure #--enable-optimizations + +make -j $(nproc) + +make install + +# Set python3.10 as the default version. +py3="$(which python3)" +rm "$py3" +ln "$(which python3.10)" "$py3" +python3 --version + diff --git a/metadata-ingestion-modules/airflow-plugin/build.gradle b/metadata-ingestion-modules/airflow-plugin/build.gradle index 9a48c2a3bc..9ab590b156 100644 --- a/metadata-ingestion-modules/airflow-plugin/build.gradle +++ b/metadata-ingestion-modules/airflow-plugin/build.gradle @@ -16,7 +16,7 @@ task checkPythonVersion(type: Exec) { task environmentSetup(type: Exec, dependsOn: checkPythonVersion) { inputs.file file('setup.py') outputs.dir("${venv_name}") - commandLine 'bash', '-c', "${python_executable} -m venv ${venv_name} && ${venv_name}/bin/python -m pip install --upgrade pip wheel setuptools==57.5.0" + commandLine 'bash', '-c', "${python_executable} -m venv ${venv_name} && ${venv_name}/bin/python -m pip install --upgrade pip wheel 'setuptools>=63.0.0'" } task installPackage(type: Exec, dependsOn: environmentSetup) { diff --git a/metadata-ingestion/scripts/install_deps.sh b/metadata-ingestion/scripts/install_deps.sh index d85082f396..e1d735c525 100755 --- a/metadata-ingestion/scripts/install_deps.sh +++ b/metadata-ingestion/scripts/install_deps.sh @@ -14,7 +14,9 @@ else librdkafka-devel \ openldap-devel \ cyrus-sasl-devel \ - openldap-clients + openldap-clients \ + sqlite-devel \ + xz-devel else $sudo_cmd apt-get update && $sudo_cmd apt-get install -y \ librdkafka-dev \ diff --git a/vercel.json b/vercel.json index dddc6adc8f..d5515e68b0 100644 --- a/vercel.json +++ b/vercel.json @@ -4,6 +4,6 @@ "silent": true, "autoJobCancelation": true }, - "installCommand": "amazon-linux-extras install python3.8 && py3=\"$(which python3)\" && rm \"$py3\" && ln \"$(which python3.8)\" \"$py3\" && ./metadata-ingestion/scripts/install_deps.sh && yum install -y gcc python38-devel", + "installCommand": "./docs-website/vercel-setup.sh", "outputDirectory": "docs-website/build" }