aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile119
1 files changed, 54 insertions, 65 deletions
diff --git a/Makefile b/Makefile
index 8608982..b54e8ad 100644
--- a/Makefile
+++ b/Makefile
@@ -1,59 +1,56 @@
-all: hypervideo README.md CONTRIBUTING.md README.txt hypervideo.1 hypervideo.bash-completion hypervideo.zsh hypervideo.fish
+all: hypervideo doc pypi-files
+clean: clean-test clean-dist clean-cache
+completions: completion-bash completion-fish completion-zsh
+doc: README.md CONTRIBUTING.md
+ot: offlinetest
+tar: hypervideo.tar.gz
-clean:
- rm -rf hypervideo.1.temp.md hypervideo.1 hypervideo.bash-completion README.txt MANIFEST build/ dist/ .coverage cover/ hypervideo.tar.gz hypervideo.zsh hypervideo.fish hypervideo_dl/extractor/lazy_extractors.py *.dump *.part* *.ytdl *.info.json *.mp4 *.m4a *.flv *.mp3 *.avi *.mkv *.webm *.3gp *.wav *.ape *.swf *.jpg *.png CONTRIBUTING.md.tmp hypervideo hypervideo.exe
- find . -name "*.pyc" -delete
- find . -name "*.class" -delete
+# Keep this list in sync with MANIFEST.in
+# intended use: when building a source distribution,
+# make pypi-files && python setup.py sdist
+pypi-files: AUTHORS Changelog.md LICENSE README.md completions devscripts/* test/*
+
+.PHONY: all clean install test tar pypi-files completions ot offlinetest codetest
+
+clean-test:
+ rm -rf *.3gp *.annotations.xml *.ape *.avi *.description *.dump *.flac *.flv *.frag *.frag.aria2 *.frag.urls \
+ *.info.json *.jpeg *.jpg *.live_chat.json *.m4a *.m4v *.mkv *.mp3 *.mp4 *.ogg *.opus *.part* *.png *.sbv *.srt \
+ *.swf *.swp *.ttml *.vtt *.wav *.webm *.webp *.ytdl test/testdata/player-*.js
+clean-dist:
+ rm -rf MANIFEST build/ dist/ .coverage cover/ hypervideo.tar.gz completions/ hypervideo_dl/extractor/lazy_extractors.py *.spec CONTRIBUTING.md.tmp hypervideo hypervideo.exe hypervideo_dl.egg-info/ AUTHORS .mailmap
+clean-cache:
+ find . -name "*.pyc" -o -name "*.class" -delete
+
+completion-bash: completions/bash/hypervideo
+completion-fish: completions/fish/hypervideo.fish
+completion-zsh: completions/zsh/_hypervideo
+lazy-extractors: hypervideo_dl/extractor/lazy_extractors.py
PREFIX ?= /usr/local
+DESTDIR ?= .
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/man
SHAREDIR ?= $(PREFIX)/share
-PYTHON ?= /usr/bin/env python
+PYTHON ?= /usr/bin/env python3
# set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local
SYSCONFDIR = $(shell if [ $(PREFIX) = /usr -o $(PREFIX) = /usr/local ]; then echo /etc; else echo $(PREFIX)/etc; fi)
-# set markdown input format to "markdown-smart" for pandoc version 2 and to "markdown" for pandoc prior to version 2
-MARKDOWN = $(shell if [ `pandoc -v | head -n1 | cut -d" " -f2 | head -c1` = "2" ]; then echo markdown-smart; else echo markdown; fi)
-
-install: hypervideo hypervideo.1 hypervideo.bash-completion hypervideo.zsh hypervideo.fish
- install -d $(DESTDIR)$(BINDIR)
- install -m 755 hypervideo $(DESTDIR)$(BINDIR)
- install -d $(DESTDIR)$(MANDIR)/man1
- install -m 644 hypervideo.1 $(DESTDIR)$(MANDIR)/man1
- install -d $(DESTDIR)$(SYSCONFDIR)/bash_completion.d
- install -m 644 hypervideo.bash-completion $(DESTDIR)$(SYSCONFDIR)/bash_completion.d/hypervideo
- install -d $(DESTDIR)$(SHAREDIR)/zsh/site-functions
- install -m 644 hypervideo.zsh $(DESTDIR)$(SHAREDIR)/zsh/site-functions/_hypervideo
- install -d $(DESTDIR)$(SYSCONFDIR)/fish/completions
- install -m 644 hypervideo.fish $(DESTDIR)$(SYSCONFDIR)/fish/completions/hypervideo.fish
+install: hypervideo completions
+ install -Dm755 hypervideo $(DESTDIR)$(BINDIR)
+ install -Dm644 completions/bash/hypervideo $(DESTDIR)$(SHAREDIR)/bash-completion/completions/hypervideo
+ install -Dm644 completions/zsh/_hypervideo $(DESTDIR)$(SHAREDIR)/zsh/site-functions/_hypervideo
+ install -Dm644 completions/fish/hypervideo.fish $(DESTDIR)$(SHAREDIR)/fish/vendor_completions.d/hypervideo.fish
codetest:
flake8 .
test:
- nosetests --verbose test
+ $(PYTHON) -m pytest
$(MAKE) codetest
-ot: offlinetest
-
-# Keep this list in sync with devscripts/run_tests.sh
offlinetest: codetest
- $(PYTHON) -m nose --verbose test \
- --exclude test_age_restriction.py \
- --exclude test_download.py \
- --exclude test_socks.py \
- --exclude test_subtitles.py \
- --exclude test_write_annotations.py \
- --exclude test_youtube_lists.py \
- --exclude test_youtube_signature.py
-
-tar: hypervideo.tar.gz
-
-.PHONY: all clean install test tar bash-completion pypi-files zsh-completion fish-completion ot offlinetest codetest
-
-pypi-files: hypervideo.bash-completion README.txt hypervideo.1 hypervideo.fish
+ $(PYTHON) -m pytest -k "not download"
hypervideo: hypervideo_dl/*.py hypervideo_dl/*/*.py
mkdir -p zip
@@ -76,37 +73,24 @@ README.md: hypervideo_dl/*.py hypervideo_dl/*/*.py
CONTRIBUTING.md: README.md
$(PYTHON) devscripts/make_contributing.py README.md CONTRIBUTING.md
-README.txt: README.md
- pandoc -f $(MARKDOWN) -t plain README.md -o README.txt
-
-hypervideo.1: README.md
- $(PYTHON) devscripts/prepare_manpage.py hypervideo.1.temp.md
- pandoc -s -f $(MARKDOWN) -t man hypervideo.1.temp.md -o hypervideo.1
- rm -f hypervideo.1.temp.md
-
-hypervideo.bash-completion: hypervideo_dl/*.py hypervideo_dl/*/*.py devscripts/bash-completion.in
+completions/bash/hypervideo: hypervideo_dl/*.py hypervideo_dl/*/*.py devscripts/bash-completion.in
+ mkdir -p completions/bash
$(PYTHON) devscripts/bash-completion.py
-bash-completion: hypervideo.bash-completion
-
-hypervideo.zsh: hypervideo_dl/*.py hypervideo_dl/*/*.py devscripts/zsh-completion.in
+completions/zsh/_hypervideo: hypervideo_dl/*.py hypervideo_dl/*/*.py devscripts/zsh-completion.in
+ mkdir -p completions/zsh
$(PYTHON) devscripts/zsh-completion.py
-zsh-completion: hypervideo.zsh
-
-hypervideo.fish: hypervideo_dl/*.py hypervideo_dl/*/*.py devscripts/fish-completion.in
+completions/fish/hypervideo.fish: hypervideo_dl/*.py hypervideo_dl/*/*.py devscripts/fish-completion.in
+ mkdir -p completions/fish
$(PYTHON) devscripts/fish-completion.py
-fish-completion: hypervideo.fish
-
-lazy-extractors: hypervideo_dl/extractor/lazy_extractors.py
-
_EXTRACTOR_FILES = $(shell find hypervideo_dl/extractor -iname '*.py' -and -not -iname 'lazy_extractors.py')
hypervideo_dl/extractor/lazy_extractors.py: devscripts/make_lazy_extractors.py devscripts/lazy_load_template.py $(_EXTRACTOR_FILES)
$(PYTHON) devscripts/make_lazy_extractors.py $@
-hypervideo.tar.gz: hypervideo README.md README.txt hypervideo.1 hypervideo.bash-completion hypervideo.zsh hypervideo.fish ChangeLog AUTHORS
- @tar -czf hypervideo.tar.gz --transform "s|^|hypervideo/|" --owner 0 --group 0 \
+hypervideo.tar.gz: all
+ @tar -czf $(DESTDIR)/hypervideo.tar.gz --transform "s|^|hypervideo/|" --owner 0 --group 0 \
--exclude '*.DS_Store' \
--exclude '*.kate-swp' \
--exclude '*.pyc' \
@@ -114,10 +98,15 @@ hypervideo.tar.gz: hypervideo README.md README.txt hypervideo.1 hypervideo.bash-
--exclude '*~' \
--exclude '__pycache__' \
--exclude '.git' \
- --exclude 'docs/_build' \
-- \
- bin devscripts test hypervideo_dl docs \
- ChangeLog AUTHORS LICENSE README.md README.txt \
- Makefile MANIFEST.in hypervideo.1 hypervideo.bash-completion \
- hypervideo.zsh hypervideo.fish setup.py setup.cfg \
- hypervideo
+ bin README.md Changelog.md LICENSE \
+ CONTRIBUTING.md CONTRIBUTORS AUTHORS \
+ Makefile MANIFEST.in README.md completions \
+ setup.py setup.cfg hypervideo hypervideo_dl requirements.txt \
+ devscripts test tox.ini pytest.ini
+
+AUTHORS: .mailmap
+ git shortlog -s -n | cut -f2 | sort > AUTHORS
+
+.mailmap:
+ git shortlog -s -e -n | awk '!(out[$$NF]++) { $$1="";sub(/^[ \t]+/,""); print}' > .mailmap