]> jfr.im git - yt-dlp.git/blobdiff - Makefile
[misc] Cleanup (#9765)
[yt-dlp.git] / Makefile
index 9344003f8603e909c1a3e87318d6c9456ad36b15..e1de7f3e91a7bf041e8c340255fb576a3169ab6a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ all: lazy-extractors yt-dlp doc pypi-files
 clean: clean-test clean-dist
 clean-all: clean clean-cache
 completions: completion-bash completion-fish completion-zsh
-doc: README.md CONTRIBUTING.md issuetemplates supportedsites
+doc: README.md CONTRIBUTING.md CONTRIBUTORS issuetemplates supportedsites
 ot: offlinetest
 tar: yt-dlp.tar.gz
 
@@ -10,9 +10,12 @@ tar: yt-dlp.tar.gz
 # intended use: when building a source distribution,
 # make pypi-files && python3 -m build -sn .
 pypi-files: AUTHORS Changelog.md LICENSE README.md README.txt supportedsites \
-               completions yt-dlp.1 pyproject.toml setup.cfg devscripts/* test/*
+            completions yt-dlp.1 pyproject.toml setup.cfg devscripts/* test/*
 
-.PHONY: all clean install test tar pypi-files completions ot offlinetest codetest supportedsites
+.PHONY: all clean clean-all clean-test clean-dist clean-cache \
+        completions completion-bash completion-fish completion-zsh \
+        doc issuetemplates supportedsites ot offlinetest codetest test \
+        tar pypi-files lazy-extractors install uninstall
 
 clean-test:
        rm -rf test/testdata/sigs/player-*.js tmp/ *.annotations.xml *.aria2 *.description *.dump *.frag \
@@ -24,7 +27,7 @@ clean-dist:
        yt_dlp/extractor/lazy_extractors.py *.spec CONTRIBUTING.md.tmp yt-dlp yt-dlp.exe yt_dlp.egg-info/ AUTHORS
 clean-cache:
        find . \( \
-               -type d -name .pytest_cache -o -type d -name __pycache__ -o -name "*.pyc" -o -name "*.class" \
+               -type d -name ".*_cache" -o -type d -name __pycache__ -o -name "*.pyc" -o -name "*.class" \
        \) -prune -exec rm -rf {} \;
 
 completion-bash: completions/bash/yt-dlp
@@ -67,14 +70,15 @@ uninstall:
        rm -f $(DESTDIR)$(SHAREDIR)/fish/vendor_completions.d/yt-dlp.fish
 
 codetest:
-       flake8 .
+       ruff check .
+       autopep8 --diff .
 
 test:
-       $(PYTHON) -m pytest
+       $(PYTHON) -m pytest -Werror
        $(MAKE) codetest
 
 offlinetest: codetest
-       $(PYTHON) -m pytest -k "not download"
+       $(PYTHON) -m pytest -Werror -m "not download"
 
 CODE_FOLDERS_CMD = find yt_dlp -type f -name '__init__.py' | sed 's,/__init__.py,,' | grep -v '/__' | sort
 CODE_FOLDERS != $(CODE_FOLDERS_CMD)
@@ -148,7 +152,7 @@ yt-dlp.tar.gz: all
                --exclude '*.pyo' \
                --exclude '*~' \
                --exclude '__pycache__' \
-               --exclude '.pytest_cache' \
+               --exclude '.*_cache' \
                --exclude '.git' \
                -- \
                README.md supportedsites.md Changelog.md LICENSE \
@@ -156,5 +160,14 @@ yt-dlp.tar.gz: all
                Makefile yt-dlp.1 README.txt completions .gitignore \
                setup.cfg yt-dlp yt_dlp pyproject.toml devscripts test
 
-AUTHORS:
-       git shortlog -s -n HEAD | cut -f2 | sort > AUTHORS
+AUTHORS: Changelog.md
+       @if [ -d '.git' ] && command -v git > /dev/null ; then \
+         echo 'Generating $@ from git commit history' ; \
+         git shortlog -s -n HEAD | cut -f2 | sort > $@ ; \
+       fi
+
+CONTRIBUTORS: Changelog.md
+       @if [ -d '.git' ] && command -v git > /dev/null ; then \
+         echo 'Updating $@ from git commit history' ; \
+         $(PYTHON) devscripts/make_changelog.py -v -c > /dev/null ; \
+       fi