diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..55e1a17442 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +Makefile* text whitespace=-tab-in-indent diff --git a/Makefile b/Makefile index 24e7c57f09..c3669a0365 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ all: yt-dlp doc man doc: README.md CONTRIBUTING.md issuetemplates supportedsites -man: README.txt yt-dlp.1 yt-dlp.bash-completion yt-dlp.zsh yt-dlp.fish +man: README.txt yt-dlp.1 bash-completion zsh-completion fish-completion clean: - rm -rf yt-dlp.1.temp.md yt-dlp.1 yt-dlp.bash-completion README.txt MANIFEST build/ dist/ .coverage cover/ yt-dlp.tar.gz yt-dlp.zsh yt-dlp.fish yt_dlp/extractor/lazy_extractors.py *.dump *.part* *.ytdl *.info.json *.mp4 *.m4a *.flv *.mp3 *.avi *.mkv *.webm *.3gp *.wav *.ape *.swf *.jpg *.png *.spec *.frag *.frag.urls *.frag.aria2 CONTRIBUTING.md.tmp yt-dlp yt-dlp.exe + rm -rf yt-dlp.1.temp.md yt-dlp.1 README.txt MANIFEST build/ dist/ .coverage cover/ yt-dlp.tar.gz completions/ yt_dlp/extractor/lazy_extractors.py *.dump *.part* *.ytdl *.info.json *.mp4 *.m4a *.flv *.mp3 *.avi *.mkv *.webm *.3gp *.wav *.ape *.swf *.jpg *.png *.spec *.frag *.frag.urls *.frag.aria2 CONTRIBUTING.md.tmp yt-dlp yt-dlp.exe find . -name "*.pyc" -delete find . -name "*.class" -delete @@ -21,17 +21,12 @@ SYSCONFDIR = $(shell if [ $(PREFIX) = /usr -o $(PREFIX) = /usr/local ]; then ech # 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: yt-dlp yt-dlp.1 yt-dlp.bash-completion yt-dlp.zsh yt-dlp.fish - install -d $(DESTDIR)$(BINDIR) - install -m 755 yt-dlp $(DESTDIR)$(BINDIR) - install -d $(DESTDIR)$(MANDIR)/man1 - install -m 644 yt-dlp.1 $(DESTDIR)$(MANDIR)/man1 - install -d $(DESTDIR)$(SYSCONFDIR)/bash_completion.d - install -m 644 yt-dlp.bash-completion $(DESTDIR)$(SYSCONFDIR)/bash_completion.d/yt-dlp - install -d $(DESTDIR)$(SHAREDIR)/zsh/site-functions - install -m 644 yt-dlp.zsh $(DESTDIR)$(SHAREDIR)/zsh/site-functions/_yt-dlp - install -d $(DESTDIR)$(SYSCONFDIR)/fish/completions - install -m 644 yt-dlp.fish $(DESTDIR)$(SYSCONFDIR)/fish/completions/yt-dlp.fish +install: yt-dlp yt-dlp.1 bash-completion zsh-completion fish-completion + install -Dm755 yt-dlp $(DESTDIR)$(BINDIR) + install -Dm644 yt-dlp.1 $(DESTDIR)$(MANDIR)/man1 + install -Dm644 completions/bash/yt-dlp $(DESTDIR)$(SHAREDIR)/bash-completion/completions/yt-dlp + install -Dm644 completions/zsh/_yt-dlp $(DESTDIR)$(SHAREDIR)/zsh/site-functions/_yt-dlp + install -Dm644 completions/fish/yt-dlp.fish $(DESTDIR)$(SHAREDIR)/fish/vendor_completions.d/yt-dlp.fish codetest: flake8 . @@ -61,7 +56,7 @@ tar: yt-dlp.tar.gz .PHONY: all clean install test tar bash-completion pypi-files zsh-completion fish-completion ot offlinetest codetest supportedsites -pypi-files: yt-dlp.bash-completion README.txt yt-dlp.1 yt-dlp.fish +pypi-files: README.txt yt-dlp.1 bash-completion zsh-completion fish-completion yt-dlp: yt_dlp/*.py yt_dlp/*/*.py mkdir -p zip @@ -102,20 +97,23 @@ yt-dlp.1: README.md pandoc -s -f $(MARKDOWN) -t man yt-dlp.1.temp.md -o yt-dlp.1 rm -f yt-dlp.1.temp.md -yt-dlp.bash-completion: yt_dlp/*.py yt_dlp/*/*.py devscripts/bash-completion.in +completions/bash/yt-dlp: yt_dlp/*.py yt_dlp/*/*.py devscripts/bash-completion.in + mkdir -p completions/bash $(PYTHON) devscripts/bash-completion.py -bash-completion: yt-dlp.bash-completion +bash-completion: completions/bash/yt-dlp -yt-dlp.zsh: yt_dlp/*.py yt_dlp/*/*.py devscripts/zsh-completion.in +completions/zsh/_yt-dlp: yt_dlp/*.py yt_dlp/*/*.py devscripts/zsh-completion.in + mkdir -p completions/zsh $(PYTHON) devscripts/zsh-completion.py -zsh-completion: yt-dlp.zsh +zsh-completion: completions/zsh/_yt-dlp -yt-dlp.fish: yt_dlp/*.py yt_dlp/*/*.py devscripts/fish-completion.in +completions/fish/yt-dlp.fish: yt_dlp/*.py yt_dlp/*/*.py devscripts/fish-completion.in + mkdir -p completions/fish $(PYTHON) devscripts/fish-completion.py -fish-completion: yt-dlp.fish +fish-completion: completions/fish/yt-dlp.fish lazy-extractors: yt_dlp/extractor/lazy_extractors.py @@ -123,7 +121,7 @@ _EXTRACTOR_FILES = $(shell find yt_dlp/extractor -iname '*.py' -and -not -iname yt_dlp/extractor/lazy_extractors.py: devscripts/make_lazy_extractors.py devscripts/lazy_load_template.py $(_EXTRACTOR_FILES) $(PYTHON) devscripts/make_lazy_extractors.py $@ -yt-dlp.tar.gz: yt-dlp README.md README.txt yt-dlp.1 yt-dlp.bash-completion yt-dlp.zsh yt-dlp.fish ChangeLog AUTHORS +yt-dlp.tar.gz: yt-dlp README.md README.txt yt-dlp.1 bash-completion zsh-completion fish-completion ChangeLog AUTHORS @tar -czf yt-dlp.tar.gz --transform "s|^|yt-dlp/|" --owner 0 --group 0 \ --exclude '*.DS_Store' \ --exclude '*.kate-swp' \ @@ -136,6 +134,5 @@ yt-dlp.tar.gz: yt-dlp README.md README.txt yt-dlp.1 yt-dlp.bash-completion yt-dl -- \ bin devscripts test yt_dlp docs \ ChangeLog AUTHORS LICENSE README.md supportedsites.md README.txt \ - Makefile MANIFEST.in yt-dlp.1 yt-dlp.bash-completion \ - yt-dlp.zsh yt-dlp.fish setup.py setup.cfg \ - yt-dlp + Makefile MANIFEST.in yt-dlp.1 completions \ + setup.py setup.cfg yt-dlp diff --git a/devscripts/bash-completion.py b/devscripts/bash-completion.py index 66c3d14f7f..a41aa4c620 100755 --- a/devscripts/bash-completion.py +++ b/devscripts/bash-completion.py @@ -8,7 +8,7 @@ import sys sys.path.insert(0, dirn(dirn((os.path.abspath(__file__))))) import yt_dlp -BASH_COMPLETION_FILE = "yt-dlp.bash-completion" +BASH_COMPLETION_FILE = "completions/bash/yt-dlp" BASH_COMPLETION_TEMPLATE = "devscripts/bash-completion.in" diff --git a/devscripts/fish-completion.py b/devscripts/fish-completion.py index 1c91f722b8..5313c4a016 100755 --- a/devscripts/fish-completion.py +++ b/devscripts/fish-completion.py @@ -10,7 +10,7 @@ sys.path.insert(0, dirn(dirn((os.path.abspath(__file__))))) import yt_dlp from yt_dlp.utils import shell_quote -FISH_COMPLETION_FILE = 'yt-dlp.fish' +FISH_COMPLETION_FILE = 'completions/fish/yt-dlp.fish' FISH_COMPLETION_TEMPLATE = 'devscripts/fish-completion.in' EXTRA_ARGS = { diff --git a/devscripts/zsh-completion.py b/devscripts/zsh-completion.py index 92eac58736..68d40014ba 100755 --- a/devscripts/zsh-completion.py +++ b/devscripts/zsh-completion.py @@ -8,7 +8,7 @@ import sys sys.path.insert(0, dirn(dirn((os.path.abspath(__file__))))) import yt_dlp -ZSH_COMPLETION_FILE = "yt-dlp.zsh" +ZSH_COMPLETION_FILE = "completions/zsh/_yt-dlp" ZSH_COMPLETION_TEMPLATE = "devscripts/zsh-completion.in" diff --git a/setup.py b/setup.py index e5c9fec4c0..20dbe573cf 100644 --- a/setup.py +++ b/setup.py @@ -27,8 +27,9 @@ if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe': print("inv") else: files_spec = [ - ('etc/bash_completion.d', ['yt-dlp.bash-completion']), - ('etc/fish/completions', ['yt-dlp.fish']), + ('share/bash-completion/completions', ['completions/bash/*']), + ('share/zsh/site-functions', ['completions/zsh/*']), + ('share/fish/vendor_completions.d', ['completions/fish/*']), ('share/doc/yt_dlp', ['README.txt']), ('share/man/man1', ['yt-dlp.1']) ] @@ -86,7 +87,7 @@ setup( #'Funding': 'https://donate.pypi.org', }, classifiers=[ - "Topic :: Multimedia :: Video", + "Topic :: Multimedia :: Video", "Development Status :: 5 - Production/Stable", "Environment :: Console", "Programming Language :: Python", @@ -110,7 +111,7 @@ setup( "Operating System :: OS Independent", ], python_requires='>=2.6', - - cmdclass={'build_lazy_extractors': build_lazy_extractors}, + + cmdclass={'build_lazy_extractors': build_lazy_extractors}, **params )