Просмотр исходного кода

ref: use `pip install --constraint` instead of `grep` (#41136)

manually validated this in both `sentry` and `getsentry`
anthony sottile 2 лет назад
Родитель
Сommit
e23fb21254
3 измененных файлов с 5 добавлено и 9 удалено
  1. 1 1
      .github/workflows/backend.yml
  2. 1 1
      .github/workflows/bump-sentry-in-getsentry.yml
  3. 3 7
      scripts/lib.sh

+ 1 - 1
.github/workflows/backend.yml

@@ -199,7 +199,7 @@ jobs:
           python-version: 3.8.13
       - name: check requirements
         run: |
-          python -m pip install -q "$(grep '^pip-tools==' requirements-dev-frozen.txt)"
+          python -m pip install -q --constraint requirements-dev-frozen.txt pip-tools
           python -S -m tools.freeze_requirements sentry
           if ! git diff --exit-code; then
             echo $'\n\nrun `make freeze-requirements` locally to update requirements'

+ 1 - 1
.github/workflows/bump-sentry-in-getsentry.yml

@@ -32,7 +32,7 @@ jobs:
         shell: bash
         run: |
           cd getsentry
-          python -m pip install -q "$(grep '^pip-tools==' requirements-dev-frozen.txt)"
+          python -m pip install -q --constraint requirements-dev-frozen.txt pip-tools
 
       - name: bump-sentry ${{ github.sha }}
         shell: bash

+ 3 - 7
scripts/lib.sh

@@ -18,10 +18,6 @@ fi
 
 venv_name=".venv"
 
-pip-install() {
-    pip install $(grep ^-- requirements-base.txt) "$@"
-}
-
 # Check if a command is available
 require() {
     command -v "$1" >/dev/null 2>&1
@@ -80,7 +76,7 @@ sudo-askpass() {
 }
 
 upgrade-pip() {
-    pip-install $(grep -E '^(pip|setuptools|wheel)==' requirements-dev-frozen.txt)
+    pip install --constraint requirements-dev-frozen.txt pip setuptools wheel
 }
 
 install-py-dev() {
@@ -97,7 +93,7 @@ install-py-dev() {
     # 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.
-    SENTRY_LIGHT_BUILD=1 pip-install -e '.[dev]'
+    SENTRY_LIGHT_BUILD=1 pip install --constraint requirements-dev-frozen.txt -e '.[dev]'
 }
 
 setup-git-config() {
@@ -124,7 +120,7 @@ setup-git() {
         exit 1
     )
     if ! require pre-commit; then
-        pip-install -r requirements-dev-only-frozen.txt
+        pip install -r requirements-dev-only-frozen.txt
     fi
     pre-commit install --install-hooks
     echo ""