Makefile 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. all: youtube-dl README.md CONTRIBUTING.md README.txt youtube-dl.1 youtube-dl.bash-completion youtube-dl.zsh youtube-dl.fish supportedsites
  2. clean:
  3. rm -rf youtube-dl.1.temp.md youtube-dl.1 youtube-dl.bash-completion README.txt MANIFEST build/ dist/ .coverage cover/ youtube-dl.tar.gz youtube-dl.zsh youtube-dl.fish youtube_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 ISSUE_TEMPLATE.md.tmp youtube-dl youtube-dl.exe
  4. find . -name "*.pyc" -delete
  5. find . -name "*.class" -delete
  6. PREFIX ?= /usr/local
  7. BINDIR ?= $(PREFIX)/bin
  8. MANDIR ?= $(PREFIX)/man
  9. SHAREDIR ?= $(PREFIX)/share
  10. PYTHON ?= /usr/bin/env python
  11. # set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local
  12. SYSCONFDIR = $(shell if [ $(PREFIX) = /usr -o $(PREFIX) = /usr/local ]; then echo /etc; else echo $(PREFIX)/etc; fi)
  13. # set markdown input format to "markdown-smart" for pandoc version 2 and to "markdown" for pandoc prior to version 2
  14. MARKDOWN = $(shell if [ `pandoc -v | head -n1 | cut -d" " -f2 | head -c1` = "2" ]; then echo markdown-smart; else echo markdown; fi)
  15. install: youtube-dl youtube-dl.1 youtube-dl.bash-completion youtube-dl.zsh youtube-dl.fish
  16. install -d $(DESTDIR)$(BINDIR)
  17. install -m 755 youtube-dl $(DESTDIR)$(BINDIR)
  18. install -d $(DESTDIR)$(MANDIR)/man1
  19. install -m 644 youtube-dl.1 $(DESTDIR)$(MANDIR)/man1
  20. install -d $(DESTDIR)$(SYSCONFDIR)/bash_completion.d
  21. install -m 644 youtube-dl.bash-completion $(DESTDIR)$(SYSCONFDIR)/bash_completion.d/youtube-dl
  22. install -d $(DESTDIR)$(SHAREDIR)/zsh/site-functions
  23. install -m 644 youtube-dl.zsh $(DESTDIR)$(SHAREDIR)/zsh/site-functions/_youtube-dl
  24. install -d $(DESTDIR)$(SYSCONFDIR)/fish/completions
  25. install -m 644 youtube-dl.fish $(DESTDIR)$(SYSCONFDIR)/fish/completions/youtube-dl.fish
  26. codetest:
  27. flake8 .
  28. test:
  29. #nosetests --with-coverage --cover-package=youtube_dl --cover-html --verbose --processes 4 test
  30. nosetests --verbose test
  31. $(MAKE) codetest
  32. ot: offlinetest
  33. # Keep this list in sync with devscripts/run_tests.sh
  34. offlinetest: codetest
  35. $(PYTHON) -m nose --verbose test \
  36. --exclude test_age_restriction.py \
  37. --exclude test_download.py \
  38. --exclude test_iqiyi_sdk_interpreter.py \
  39. --exclude test_socks.py \
  40. --exclude test_subtitles.py \
  41. --exclude test_write_annotations.py \
  42. --exclude test_youtube_lists.py \
  43. --exclude test_youtube_signature.py
  44. tar: youtube-dl.tar.gz
  45. .PHONY: all clean install test tar bash-completion pypi-files zsh-completion fish-completion ot offlinetest codetest supportedsites
  46. pypi-files: youtube-dl.bash-completion README.txt youtube-dl.1 youtube-dl.fish
  47. youtube-dl: youtube_dl/*.py youtube_dl/*/*.py
  48. mkdir -p zip
  49. for d in youtube_dl youtube_dl/downloader youtube_dl/extractor youtube_dl/postprocessor ; do \
  50. mkdir -p zip/$$d ;\
  51. cp -pPR $$d/*.py zip/$$d/ ;\
  52. done
  53. touch -t 200001010101 zip/youtube_dl/*.py zip/youtube_dl/*/*.py
  54. mv zip/youtube_dl/__main__.py zip/
  55. cd zip ; zip -q ../youtube-dl youtube_dl/*.py youtube_dl/*/*.py __main__.py
  56. rm -rf zip
  57. echo '#!$(PYTHON)' > youtube-dl
  58. cat youtube-dl.zip >> youtube-dl
  59. rm youtube-dl.zip
  60. chmod a+x youtube-dl
  61. README.md: youtube_dl/*.py youtube_dl/*/*.py
  62. COLUMNS=80 $(PYTHON) youtube_dl/__main__.py --help | $(PYTHON) devscripts/make_readme.py
  63. CONTRIBUTING.md: README.md
  64. $(PYTHON) devscripts/make_contributing.py README.md CONTRIBUTING.md
  65. .github/ISSUE_TEMPLATE.md: devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl.md youtube_dl/version.py
  66. $(PYTHON) devscripts/make_issue_template.py .github/ISSUE_TEMPLATE_tmpl.md .github/ISSUE_TEMPLATE.md
  67. supportedsites:
  68. $(PYTHON) devscripts/make_supportedsites.py docs/supportedsites.md
  69. README.txt: README.md
  70. pandoc -f $(MARKDOWN) -t plain README.md -o README.txt
  71. youtube-dl.1: README.md
  72. $(PYTHON) devscripts/prepare_manpage.py youtube-dl.1.temp.md
  73. pandoc -s -f $(MARKDOWN) -t man youtube-dl.1.temp.md -o youtube-dl.1
  74. rm -f youtube-dl.1.temp.md
  75. youtube-dl.bash-completion: youtube_dl/*.py youtube_dl/*/*.py devscripts/bash-completion.in
  76. $(PYTHON) devscripts/bash-completion.py
  77. bash-completion: youtube-dl.bash-completion
  78. youtube-dl.zsh: youtube_dl/*.py youtube_dl/*/*.py devscripts/zsh-completion.in
  79. $(PYTHON) devscripts/zsh-completion.py
  80. zsh-completion: youtube-dl.zsh
  81. youtube-dl.fish: youtube_dl/*.py youtube_dl/*/*.py devscripts/fish-completion.in
  82. $(PYTHON) devscripts/fish-completion.py
  83. fish-completion: youtube-dl.fish
  84. lazy-extractors: youtube_dl/extractor/lazy_extractors.py
  85. _EXTRACTOR_FILES = $(shell find youtube_dl/extractor -iname '*.py' -and -not -iname 'lazy_extractors.py')
  86. youtube_dl/extractor/lazy_extractors.py: devscripts/make_lazy_extractors.py devscripts/lazy_load_template.py $(_EXTRACTOR_FILES)
  87. $(PYTHON) devscripts/make_lazy_extractors.py $@
  88. youtube-dl.tar.gz: youtube-dl README.md README.txt youtube-dl.1 youtube-dl.bash-completion youtube-dl.zsh youtube-dl.fish ChangeLog AUTHORS
  89. @tar -czf youtube-dl.tar.gz --transform "s|^|youtube-dl/|" --owner 0 --group 0 \
  90. --exclude '*.DS_Store' \
  91. --exclude '*.kate-swp' \
  92. --exclude '*.pyc' \
  93. --exclude '*.pyo' \
  94. --exclude '*~' \
  95. --exclude '__pycache__' \
  96. --exclude '.git' \
  97. --exclude 'docs/_build' \
  98. -- \
  99. bin devscripts test youtube_dl docs \
  100. ChangeLog AUTHORS LICENSE README.md README.txt \
  101. Makefile MANIFEST.in youtube-dl.1 youtube-dl.bash-completion \
  102. youtube-dl.zsh youtube-dl.fish setup.py setup.cfg \
  103. youtube-dl