Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify linter tests #1212

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 6 additions & 31 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,22 @@ on:
- '**.txt'
jobs:
style:
name: "${{ matrix.config.suite }}"
runs-on: ubuntu-latest
strategy:
matrix:
config:
- {suite: black}
- {suite: flake8}
- {suite: isort}

env:
PYAV_PYTHON: python3
PYAV_LIBRARY: ffmpeg-4.3 # doesn't matter

steps:
- uses: actions/checkout@v4
name: Checkout
- name: Checkout
uses: actions/checkout@v4

- name: Python
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Environment
run: env | sort

- name: Packages
run: |
. scripts/activate.sh
# A bit of a hack that we can get away with this.
python -m pip install ${{ matrix.config.suite }}
run: pip install -r tests/requirements.txt

- name: "${{ matrix.config.suite }}"
run: |
. scripts/activate.sh
./scripts/test ${{ matrix.config.suite }}
- name: Linters
run: make lint

nix:
name: "py-${{ matrix.config.python }} lib-${{ matrix.config.ffmpeg }} ${{matrix.config.os}}"
Expand Down Expand Up @@ -120,20 +101,14 @@ jobs:
if: matrix.config.extras
run: |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }}
scripts/test doctest
make -C docs test

- name: Examples
if: matrix.config.extras
run: |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }}
scripts/test examples

- name: Source Distribution
if: matrix.config.extras
run: |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }}
scripts/test sdist

windows:
name: "py-${{ matrix.config.python }} lib-${{ matrix.config.ffmpeg }} ${{matrix.config.os}}"
runs-on: ${{ matrix.config.os }}
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
# Testing.
*.spyderproject
.idea
/.vagrant
/sandbox
/tests/assets
/tests/samples
77 changes: 10 additions & 67 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,86 +5,29 @@ PYAV_PYTHON ?= python
PYTHON := $(PYAV_PYTHON)


.PHONY: default build cythonize clean clean-all info lint test fate-suite test-assets docs
.PHONY: default build clean fate-suite lint test

default: build


build:
CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) $(PYTHON) setup.py build_ext --inplace --debug

cythonize:
$(PYTHON) setup.py cythonize



wheel: build-mingw32
$(PYTHON) setup.py bdist_wheel

build-mingw32:
# before running, set PKG_CONFIG_PATH to the pkgconfig dir of the ffmpeg build.
# set PKG_CONFIG_PATH=D:\dev\3rd\media-autobuild_suite\local32\bin-video\ffmpegSHARED\lib\pkgconfig
CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) $(PYTHON) setup.py build_ext --inplace -c mingw32
mv *.pyd av


clean:
- find av -name '*.so' -delete
- rm -rf build
- rm -rf sandbox
- rm -rf src
- make -C docs clean

fate-suite:
# Grab ALL of the samples from the ffmpeg site.
rsync -vrltLW rsync://fate-suite.ffmpeg.org/fate-suite/ tests/assets/fate-suite/

lint:
TESTSUITE=flake8 scripts/test
TESTSUITE=isort scripts/test
black --check av examples tests
flake8 av examples tests
isort --check-only --diff av examples tests

test:
$(PYTHON) setup.py test



vagrant:
vagrant box list | grep -q precise32 || vagrant box add precise32 http://files.vagrantup.com/precise32.box

vtest:
vagrant ssh -c /vagrant/scripts/vagrant-test



tmp/ffmpeg-git:
@ mkdir -p tmp/ffmpeg-git
git clone --depth=1 git://source.ffmpeg.org/ffmpeg.git tmp/ffmpeg-git

tmp/Doxyfile: tmp/ffmpeg-git
cp tmp/ffmpeg-git/doc/Doxyfile $@
echo "GENERATE_TAGFILE = ../tagfile.xml" >> $@

tmp/tagfile.xml: tmp/Doxyfile
cd tmp/ffmpeg-git; doxygen ../Doxyfile

docs: tmp/tagfile.xml
PYTHONPATH=.. make -C docs html

deploy-docs: docs
./docs/upload docs




clean-build:
- rm -rf build
- find av -name '*.so' -delete

clean-sandbox:
- rm -rf sandbox/201*
- rm sandbox/last

clean-src:
- rm -rf src

clean-docs:
- rm tmp/Doxyfile
- rm tmp/tagfile.xml
- make -C docs clean

clean: clean-build clean-sandbox clean-src
clean-all: clean-build clean-sandbox clean-src clean-docs
6 changes: 4 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
SPHINXOPTS =
SPHINXBUILD = sphinx-build
BUILDDIR = _build
FFMPEGDIR = _ffmpeg

ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) .

Expand All @@ -12,7 +13,8 @@ default: html

TAGFILE := _build/doxygen/tagfile.xml
$(TAGFILE) :
./generate-tagfile -o $(TAGFILE)
git clone --depth=1 git://source.ffmpeg.org/ffmpeg.git $(FFMPEGDIR)
./generate-tagfile --library $(FFMPEGDIR) -o $(TAGFILE)


TEMPLATES := $(wildcard api/*.py development/*.py)
Expand All @@ -24,7 +26,7 @@ _build/rst/%.rst: %.py $(TAGFILE) $(shell find ../include ../av -name '*.pyx' -o


clean:
- rm -rf $(BUILDDIR)/*
rm -rf $(BUILDDIR) $(FFMPEGDIR)

html: $(RENDERED) $(TAGFILE)
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
Expand Down
42 changes: 10 additions & 32 deletions docs/generate-tagfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,23 @@
#!/usr/bin/env python

import argparse
import os
import subprocess
import argparse


parser = argparse.ArgumentParser()
parser.add_argument('-l', '--library', default=os.environ.get('PYAV_LIBRARY'))
parser.add_argument('-o', '--output', default=os.path.abspath(os.path.join(
__file__,
'..',
'_build',
'doxygen',
'tagfile.xml',
)))
parser.add_argument("-l", "--library", required=True)
parser.add_argument("-o", "--output", required=True)
args = parser.parse_args()


if not args.library:
print("Please provide --library or set $PYAV_LIBRARY")
exit(1)

library = os.path.abspath(os.path.join(
__file__,
'..', '..',
'vendor',
args.library,
))

if not os.path.exists(library):
print("Library does not exist:", library)
exit(2)


output = os.path.abspath(args.output)
outdir = os.path.dirname(output)
if not os.path.exists(outdir):
os.makedirs(outdir)


proc = subprocess.Popen(['doxygen', '-'], stdin=subprocess.PIPE, cwd=library)
proc.communicate('''
proc = subprocess.Popen(["doxygen", "-"], stdin=subprocess.PIPE, cwd=args.library)
proc.communicate(
"""

#@INCLUDE = doc/Doxyfile
GENERATE_TAGFILE = {}
Expand All @@ -49,6 +26,7 @@ GENERATE_LATEX = no
CASE_SENSE_NAMES = yes
INPUT = libavcodec libavdevice libavfilter libavformat libavresample libavutil libswresample libswscale

'''.format(output).encode())


""".format(
output
).encode()
)
33 changes: 0 additions & 33 deletions scripts/build-debug-python

This file was deleted.

Loading
Loading