diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 22d9235b7..6e85e1d77 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -24,9 +24,6 @@ jobs: with: python-version: "3.12" - - name: Packages - run: pip install -r tests/requirements.txt - - name: Linters run: make lint diff --git a/Makefile b/Makefile index 968494e2e..4830ef6a1 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,9 @@ LDFLAGS ?= "" CFLAGS ?= "-O0" PYAV_PYTHON ?= python +PYAV_PIP ?= pip PYTHON := $(PYAV_PYTHON) +PIP := $(PYAV_PIP) .PHONY: default build clean fate-suite lint test @@ -11,6 +13,8 @@ default: build build: + # Always try to install the Python dependencies they are cheap. + $(PIP) install --upgrade -r tests/requirements.txt CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) $(PYTHON) setup.py build_ext --inplace --debug clean: @@ -25,10 +29,12 @@ fate-suite: rsync -vrltLW rsync://fate-suite.ffmpeg.org/fate-suite/ tests/assets/fate-suite/ lint: + $(PIP) install --upgrade -r tests/requirements.txt black --check av examples tests setup.py flake8 av examples tests isort --check-only --diff av examples tests mypy av tests test: - $(PYTHON) setup.py test + $(PIP) install --upgrade -r tests/requirements.txt + $(PYTHON) -m pytest diff --git a/scripts/activate.sh b/scripts/activate.sh index 67cc5462e..99be26dcc 100755 --- a/scripts/activate.sh +++ b/scripts/activate.sh @@ -9,10 +9,13 @@ fi export PYAV_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.."; pwd)" if [[ ! "$PYAV_LIBRARY" ]]; then - - # Pull from command line argument. if [[ "$1" ]]; then - PYAV_LIBRARY="$1" + if [[ "$1" == ffmpeg-* ]]; then + PYAV_LIBRARY="$1" + else + echo "Error: PYAV_LIBRARY must start with 'ffmpeg-'" >&2 + return 1 + fi else PYAV_LIBRARY=ffmpeg-7.0.1 echo "No \$PYAV_LIBRARY set; defaulting to $PYAV_LIBRARY" diff --git a/scripts/build-deps b/scripts/build-deps index f151fc88d..ef7ebff22 100755 --- a/scripts/build-deps +++ b/scripts/build-deps @@ -8,12 +8,11 @@ fi cd "$PYAV_ROOT" # Always try to install the Python dependencies they are cheap. -$PYAV_PIP install --upgrade -r tests/requirements.txt - +$PYAV_PIP install --upgrade -r tests/requirements.txt 2> /dev/null # Skip the rest of the build if it already exists. if [[ -e "$PYAV_LIBRARY_PREFIX/bin/ffmpeg" ]]; then - echo "We have a cached build of $PYAV_LIBRARY; skipping re-build." + echo "We have a cached build of ffmpeg-$PYAV_LIBRARY; skipping re-build." exit 0 fi diff --git a/scripts/test b/scripts/test index 01991f5a6..270a4ec69 100755 --- a/scripts/test +++ b/scripts/test @@ -19,7 +19,7 @@ istest() { } if istest main; then - $PYAV_PYTHON setup.py test + $PYAV_PYTHON -m pytest fi if istest examples; then diff --git a/tests/requirements.txt b/tests/requirements.txt index f9f354439..2907b9e22 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -5,5 +5,6 @@ black isort flake8 flake8-pyproject +pytest sphinx==5.1.0 mypy==1.10.0