0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-25 02:45:12 +00:00

Make __main__ work in all scenarios with relative imports

This commit is contained in:
Philipp Hagemeister 2012-11-28 03:55:35 +01:00
parent 9e8056d5a7
commit f1cb5bcad2
3 changed files with 9 additions and 2 deletions

View file

@ -24,7 +24,7 @@ test:
# TODO un-phony README.md and youtube-dl.bash_completion by reading from .in files and generating from them # TODO un-phony README.md and youtube-dl.bash_completion by reading from .in files and generating from them
youtube-dl: youtube_dl/*.py youtube-dl: youtube_dl/*.py
zip --quiet --junk-paths youtube-dl youtube_dl/*.py zip --quiet youtube-dl __main__.py youtube_dl/*.py
echo '#!/usr/bin/env python' > youtube-dl echo '#!/usr/bin/env python' > youtube-dl
cat youtube-dl.zip >> youtube-dl cat youtube-dl.zip >> youtube-dl
rm youtube-dl.zip rm youtube-dl.zip

6
__main__.py Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env python
import youtube_dl
if __name__ == '__main__':
youtube_dl.main()

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Execute with python -m youtube_dl
import youtube_dl import youtube_dl