Skip to content

Commit e5f02c3

Browse files
committed
feat(dev): Add make prerequisites target
Create a new target which installs different libraries via brew depending on the context. For instance, on Apple M1 machines it should installed a couple more libraries. In the future, the bootstrap script and documentation should be using this target. Fixes #28606
1 parent 3b475d9 commit e5f02c3

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

.github/workflows/python-deps.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ jobs:
3030
- name: Install prerequisites
3131
# brew can be finicky but it does not always means that the rest of the job will fail
3232
run: |
33-
# Needed for xmlsec
34-
brew install libxmlsec1 pkg-config
33+
make prerequisites
3534
3635
- name: Setup Python
3736
uses: ./.github/actions/setup-python

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ install-py-dev :
1919
build-platform-assets \
2020
direnv-help \
2121
upgrade-pip \
22+
prerequisites \
2223
setup-git-config :
2324
@SENTRY_NO_VENV_CHECK=1 ./scripts/do.sh $@
2425

scripts/lib.sh

+18
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,24 @@ reset-db() {
216216
apply-migrations
217217
}
218218

219+
prerequisites() {
220+
if [ -z "${CI+x}" ]; then
221+
brew update -q && brew bundle -q
222+
# psycopg2-binary does not have an arm64 wheel, thus, we need to build it locally
223+
# by installing postgresql
224+
# See details: https://github.com/psycopg/psycopg2/issues/1286
225+
# Newer versions of psycopg2-binary do not need the CPP & LD flags
226+
query-apple-m1 && brew install postgresql && \
227+
CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include" \
228+
LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/python@3.8/lib" \
229+
pip install psycopg2-binary==2.8.6
230+
else
231+
# These are packages for the CI
232+
# Needed for xmlsec since there's no wheels for it
233+
brew install libxmlsec1 pkg-config
234+
fi
235+
}
236+
219237
direnv-help() {
220238
cat >&2 <<EOF
221239
If you're a Sentry employee and you're stuck or have questions, ask in #discuss-dev-tooling.

0 commit comments

Comments
 (0)