From 31ab4539dd8ac487c2c9cf5bcc5870a818111bc6 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 15 Apr 2024 10:50:15 -0400 Subject: [PATCH] update psycopg2 check to be platform based --- .../bundle/test_archive_install.sh | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/release_creation/bundle/test_archive_install.sh b/release_creation/bundle/test_archive_install.sh index 838df0db..71047451 100755 --- a/release_creation/bundle/test_archive_install.sh +++ b/release_creation/bundle/test_archive_install.sh @@ -14,18 +14,29 @@ python -m pip install -r "${requirements_file}" \ --find-links ./bundle_pkg_test \ --pre dbt --version + # make sure psycopg2 is installed, but not psycopg2-binary echo -n "Checking psycopg2 install..." -if ! pip freeze | grep psycopg2; then - echo "psycopg2 is not installed!" - exit 1 +PSYCOPG2_PIP_ENTRY=$(pip list | grep "psycopg2 " || pip list | grep psycopg2-binary) +PSYCOPG2_NAME="${PSYCOPG2_PIP_ENTRY%% *}" +if [[ "$OSTYPE" == linux* && "${PSYCOPG2_NAME}" == "pscyopg2" ]]; then + echo "psycopg2 is installed on linux as expected" + echo ok +else + echo "psycopg2-binary is installed on linux and should not be!" + exit 1 fi -echo ok - -echo -n "Checking psycopg2-binary..." -if pip freeze | grep psycopg2-binary; then - echo "psycopg2-binary is installed and should not be!" - exit 1 +if [[ "$OSTYPE" == darwin* && "${PSYCOPG2_NAME}" == "pscyopg2-binary" ]]; then + echo "psycopg2-binary is installed on linux as expected" + echo ok +else + echo "psycopg2 is installed on macos and should not be!" + exit 1 fi -echo ok -deactivate \ No newline at end of file +if [[ "$OSTYPE" != linux* && "$OSTYPE" != darwin* ]]; then + echo "unexpected OSTYPE:" + echo "$OSTYPE" + exit 1 +fi + +deactivate