Browse Source

dev_env(feat): Support getsentry calling scripts within sentry (#24095)

Armen Zambrano G 4 years ago
parent
commit
cbdd5a8473
3 changed files with 12 additions and 9 deletions
  1. 4 4
      Makefile
  2. 1 1
      scripts/bootstrap-py3-venv
  3. 7 4
      scripts/python.sh

+ 4 - 4
Makefile

@@ -56,12 +56,12 @@ setup-pyenv:
 	./scripts/pyenv_setup.sh
 
 ensure-venv:
-	@./scripts/ensure-venv.sh
+	./scripts/ensure-venv.sh
 
 ensure-pinned-pip: ensure-venv upgrade-pip
 
 upgrade-pip:
-	bash ./scripts/python.sh upgrade-pip
+	./scripts/python.sh upgrade-pip
 
 setup-git-config:
 	@git config --local branch.autosetuprebase always
@@ -92,7 +92,7 @@ install-js-dev: node-version-check
 	yarn check --verify-tree || yarn install --check-files
 
 install-py-dev:
-	bash ./scripts/python.sh install-py-dev
+	./scripts/python.sh install-py-dev
 
 build-js-po: node-version-check
 	mkdir -p build
@@ -220,4 +220,4 @@ lint-js:
 	@echo ""
 
 
-.PHONY: develop build reset-db clean setup-git node-version-check install-js-dev install-py-dev build-js-po locale compile-locale merge-locale-catalogs sync-transifex update-transifex build-platform-assets test-cli test-js test-js-build test-styleguide test-python test-snuba test-symbolicator test-acceptance lint-js
+.PHONY: develop bootstrap build reset-db clean setup-git node-version-check install-js-dev install-py-dev build-js-po locale compile-locale merge-locale-catalogs sync-transifex update-transifex build-platform-assets test-cli test-js test-js-build test-styleguide test-python test-snuba test-symbolicator test-acceptance lint-js

+ 1 - 1
scripts/bootstrap-py3-venv

@@ -45,7 +45,7 @@ if ! [[ "$(python3 -V 2>&1)" = "Python $(grep "3.6" .python-version)" ]]; then
 fi
 
 python3 -m pip install -U pip           || { echo "bootstrap failed!"; return 1; }
-python3 -m venv "${venv_name}"    || { echo "bootstrap failed!"; return 1; }
+python3 -m venv "${venv_name}"          || { echo "bootstrap failed!"; return 1; }
 source "${venv_name}/bin/activate"      || { echo "bootstrap failed!"; return 1; }
 make setup-git                          || { echo "bootstrap failed!"; return 1; }
 make install-py-dev                     || { echo "bootstrap failed!"; return 1; }

+ 7 - 4
scripts/python.sh

@@ -7,20 +7,23 @@ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd -P)"
 source "${HERE}/lib.sh"
 
 ensure-venv() {
-    ./scripts/ensure-venv.sh
+    eval "${HERE}/ensure-venv.sh"
 }
 
 upgrade-pip() {
     # pip versions before 20.1 do not have `pip cache` as a command which is necessary for the CI
     pip install --no-cache-dir --upgrade "pip>=20.1"
+    # The Python version installed via pyenv does not come with wheel pre-installed
+    # Installing wheel will speed up installation of Python dependencies
+    require wheel || pip install wheel
 }
 
 install-py-dev() {
     ensure-venv
     upgrade-pip
-    # The Python version installed via pyenv does not come with wheel pre-installed
-    # Installing wheel will speed up installation of Python dependencies
-    require wheel || pip install wheel
+    # It places us within top src dir to be at the same path as setup.py
+    # This helps when getsentry calls into this script
+    cd "${HERE}/.."
     echo "--> Installing Sentry (for development)"
     # In Big Sur, versions of pip before 20.3 require SYSTEM_VERSION_COMPAT set
     if query_big_sur && python -c 'from sys import exit; import pip; from pip._vendor.packaging.version import parse; exit(1 if parse(pip.__version__) < parse("20.3") else 0)'; then