From 359d6d86508d7b32bf50e9b1936aaf6b9478ad19 Mon Sep 17 00:00:00 2001 From: hseg Date: Thu, 25 Feb 2021 16:49:57 +0200 Subject: [PATCH] Fix completion paths, zsh pip completion install Closes: #108, #110 --- .gitattributes | 1 + Makefile | 45 ++++++++++++++++------------------- devscripts/bash-completion.py | 2 +- devscripts/fish-completion.py | 2 +- devscripts/zsh-completion.py | 2 +- setup.py | 11 +++++---- 6 files changed, 31 insertions(+), 32 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..55e1a1744 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +Makefile* text whitespace=-tab-in-indent diff --git a/Makefile b/Makefile index b27f6e695..1c2ca5e11 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 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 66c3d14f7..a41aa4c62 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 1c91f722b..5313c4a01 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 92eac5873..68d40014b 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 e5c9fec4c..20dbe573c 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 )