From 37e4c49e0b805d3537b4a3baecaab87f61b5ced1 Mon Sep 17 00:00:00 2001 From: Armen Zambrano G Date: Fri, 1 Oct 2021 08:58:06 -0400 Subject: [PATCH 1/2] fix(dev): psycopg2-binary 2.9.1 does not work with Django 2.2 For the incompatibility issue with Django visit [this issue][incompatible], In this PR, we're going to downgrade to the compatible 2.8.6 version (thus, matching the Python 3.6 version), removing the need to install `postgresql` (this means partially reverting #28607) and instead installing a wheel I built on my machine that I have stored in GC storage. Fixes #28958 [incompatible]: https://github.com/psycopg/psycopg2/issues/1293 --- .github/workflows/development-environment.yml | 2 +- Makefile | 1 - requirements-base.txt | 4 +--- scripts/lib.sh | 16 ++++++---------- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/development-environment.yml b/.github/workflows/development-environment.yml index 0a53c8e40d6097..9bce8a651561cf 100644 --- a/.github/workflows/development-environment.yml +++ b/.github/workflows/development-environment.yml @@ -51,7 +51,7 @@ jobs: # Xcode CLI & brew are already installed, thus, no need to call xcode-select install continue-on-error: true run: | - make prerequisites + brew bundle -q - name: Setup Python ${{ matrix.python-version }} uses: ./.github/actions/setup-python diff --git a/Makefile b/Makefile index 4975119f607935..ea2191a3be1a46 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,6 @@ install-py-dev : build-platform-assets \ direnv-help \ upgrade-pip \ -prerequisites \ setup-git-config : @SENTRY_NO_VENV_CHECK=1 ./scripts/do.sh $@ diff --git a/requirements-base.txt b/requirements-base.txt index 2d3a2e2164a7ed..82b5e6063bafa2 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -35,9 +35,7 @@ Pillow==8.2.0; python_version == '3.6' Pillow==8.3.1; python_version > '3.6' progressbar2==3.32.0 python-rapidjson==1.4 -psycopg2-binary==2.8.6; python_version == '3.6' -# For development only: This version removes needing to setting flags for Apple's M1 chipset -psycopg2-binary==2.9.1; python_version > '3.6' +psycopg2-binary==2.8.6 PyJWT==2.1.0 python-dateutil==2.8.1 python-memcached==1.59 diff --git a/scripts/lib.sh b/scripts/lib.sh index ecea3a7cfa8df2..9764a1f2071da5 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -129,6 +129,12 @@ install-py-dev() { # This helps when getsentry calls into this script cd "${HERE}/.." || exit echo "--> Installing Sentry (for development)" + if query-apple-m1; then + # This installs pyscopg-binary2 since there's no arm64 wheel + # This saves having to install postgresql on the Developer's machine + using flags + # https://github.com/psycopg/psycopg2/issues/1286 + pip install https://storage.googleapis.com/python-arm64-wheels/psycopg2_binary-2.8.6-cp38-cp38-macosx_11_0_arm64.whl + fi # SENTRY_LIGHT_BUILD=1 disables webpacking during setup.py. # Webpacked assets are only necessary for devserver (which does it lazily anyways) # and acceptance tests, which webpack automatically if run. @@ -256,16 +262,6 @@ reset-db() { apply-migrations } -prerequisites() { - brew update -q && brew bundle -q - if query-apple-m1; then - # psycopg2-binary does not have an arm64 wheel, thus, we need to build it locally - # by installing postgresql - # See details: https://github.com/psycopg/psycopg2/issues/1286 - brew install postgresql - fi -} - direnv-help() { cat >&2 < Date: Thu, 7 Oct 2021 11:27:45 -0400 Subject: [PATCH 2/2] Adjust prerequisites target --- .github/workflows/development-environment.yml | 2 +- Makefile | 1 + scripts/lib.sh | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/development-environment.yml b/.github/workflows/development-environment.yml index 9bce8a651561cf..0a53c8e40d6097 100644 --- a/.github/workflows/development-environment.yml +++ b/.github/workflows/development-environment.yml @@ -51,7 +51,7 @@ jobs: # Xcode CLI & brew are already installed, thus, no need to call xcode-select install continue-on-error: true run: | - brew bundle -q + make prerequisites - name: Setup Python ${{ matrix.python-version }} uses: ./.github/actions/setup-python diff --git a/Makefile b/Makefile index ea2191a3be1a46..4975119f607935 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ install-py-dev : build-platform-assets \ direnv-help \ upgrade-pip \ +prerequisites \ setup-git-config : @SENTRY_NO_VENV_CHECK=1 ./scripts/do.sh $@ diff --git a/scripts/lib.sh b/scripts/lib.sh index 9764a1f2071da5..597bd367bf72bf 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -95,7 +95,7 @@ ${red}${bold} ERROR: You're running a virtualenv with Python ${python_version}. On Apple M1 machines, we only support >= 3.8.10 < 3.9. Either run "rm -rf ${venv_name} && direnv allow" to -OR set SENTRY_PYTHON_VERSION=${python_version} to an `.env` file to bypass this check." +OR set SENTRY_PYTHON_VERSION=${python_version} to an .env file to bypass this check." EOF return 1 fi @@ -262,6 +262,10 @@ reset-db() { apply-migrations } +prerequisites() { + brew update -q && brew bundle -q +} + direnv-help() { cat >&2 <