making the script compatible with python3

This commit is contained in:
gcmalloc 2012-12-07 21:59:59 +01:00
parent 682407f2d5
commit a9d2f7e894
2 changed files with 9 additions and 7 deletions

View File

@ -38,10 +38,8 @@ README.txt: README.md
youtube-dl.1: README.md youtube-dl.1: README.md
pandoc -s -f markdown -t man README.md -o youtube-dl.1 pandoc -s -f markdown -t man README.md -o youtube-dl.1
youtube-dl.bash-completion: README.md youtube-dl.bash-completion.in youtube-dl.bash-completion: README.md devscripts/bash_completion.template
@options=`egrep -o '(--[a-z-]+) ' README.md | sort -u | xargs echo` && \ python devscripts/bash_completion.py
content=`sed "s/opts=\"[^\"]*\"/opts=\"$${options}\"/g" youtube-dl.bash-completion.in` && \
echo "$${content}" > youtube-dl.bash-completion
youtube-dl.tar.gz: all youtube-dl.tar.gz: all
tar -czf youtube-dl.tar.gz -s "|^./|./youtube-dl/|" \ tar -czf youtube-dl.tar.gz -s "|^./|./youtube-dl/|" \

View File

@ -1,4 +1,9 @@
#!/usr/bin/env python2 #!/usr/bin/env python
import os
from os.path import dirname as dirn
import sys
sys.path.append(dirn(dirn((os.path.abspath(__file__)))))
import youtube_dl import youtube_dl
BASH_COMPLETION_FILE = "youtube-dl.bash_completion" BASH_COMPLETION_FILE = "youtube-dl.bash_completion"
@ -14,7 +19,6 @@ def build_completion(opt_parser):
template = f.read() template = f.read()
with open(BASH_COMPLETION_FILE, "w") as f: with open(BASH_COMPLETION_FILE, "w") as f:
#just using the special char #just using the special char
print opts_flag
filled_template = template.replace("{{flags}}", " ".join(opts_flag)) filled_template = template.replace("{{flags}}", " ".join(opts_flag))
f.write(filled_template) f.write(filled_template)