Skip to content

Commit

Permalink
Simplify documentation generation
Browse files Browse the repository at this point in the history
Do not depend on how FFmpeg was built, just fetch a fresh clone of the
FFmpeg repository to generate doxygen tags.
  • Loading branch information
jlaine committed Nov 2, 2023
1 parent 0f978bb commit d2a1e07
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ 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
Expand Down
20 changes: 1 addition & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PYAV_PYTHON ?= python
PYTHON := $(PYAV_PYTHON)


.PHONY: default build clean docs fate-suite lint test
.PHONY: default build clean fate-suite lint test

default: build

Expand All @@ -18,7 +18,6 @@ clean:
- rm -rf build
- rm -rf sandbox
- rm -rf src
- rm -rf tmp
- make -C docs clean

fate-suite:
Expand All @@ -32,20 +31,3 @@ lint:

test:
$(PYTHON) setup.py 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
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
33 changes: 11 additions & 22 deletions docs/generate-tagfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,17 @@ 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)
if not os.path.exists(args.library):
print("Library does not exist:", args.library)
exit(2)


Expand All @@ -39,8 +26,9 @@ 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 +37,7 @@ GENERATE_LATEX = no
CASE_SENSE_NAMES = yes
INPUT = libavcodec libavdevice libavfilter libavformat libavresample libavutil libswresample libswscale
'''.format(output).encode())


""".format(
output
).encode()
)
4 changes: 0 additions & 4 deletions scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ if istest main; then
$PYAV_PYTHON setup.py test
fi

if istest doctest; then
make -C docs test
fi

if istest examples; then
for name in $(find examples -name '*.py'); do
echo
Expand Down

0 comments on commit d2a1e07

Please sign in to comment.