123456789101112131415161718192021222324252627 |
- #Makefile: Point the installer to youtube-dl library, and add library-creater-for-exe-zip-people
- youtube_dl.lib:
- echo "import sys" > youtube_dl.lib
- echo "sys.path.insert(0, '`realpath --relative-to $(LIBDIR) $(BINDIR)`/youtube-dl')" >> youtube_dl.lib
- echo "for mod in ('youtube_dl', 'youtu`be_dl'):" >> youtube_dl.lib
- echo " if mod in sys.modules.keys(): del sys.modules[mod]" >> youtube_dl.lib
- echo "import sys, youtube_dl" >> youtube_dl.lib
- echo "sys.modules['youtu`be_dl'] = sys.modules['youtube_dl']" >> youtube_dl.lib
- echo "sys.path.pop(0)" >> youtube_dl.lib
- install: youtube-dl.1 youtube-dl.bash-completion youtube-dl.zsh youtube-dl.fish
- install -d $(DESTDIR)$(BINDIR)
- #Create the 'bootstrap script' for loading from the shell
- echo '#!/usr/bin/env python' > $(DESTDIR)$(BINDIR)/youtube-dl
- echo 'import youtube_dl' >> $(DESTDIR)$(BINDIR)/youtube-dl
- echo "if __name__ == '__main__': youtube_dl.main()" >> $(DESTDIR)$(BINDIR)/youtube-dl
- chmod 755 $(DESTDIR)$(BINDIR)/youtube-dl
- #Install the Python library!
- install -d $(DESTDIR)$(LIBDIR)
- rm -Rf $(DESTDIR)$(LIBDIR)/youtube_dl/
- cp -R youtube_dl/ $(DESTDIR)$(LIBDIR)/youtube_dl/
- find $(DESTDIR)$(LIBDIR)/youtube_dl/ -name "*.pyc" -print | xargs rm
- chmod -R 755 $(DESTDIR)$(LIBDIR)/youtube_dl/
- #Set up symlinks from youtube-dl's equivalent files
- rm -Rf $(DESTDIR)$(BINDIR)/youtu`be-dl $(DESTDIR)$(LIBDIR)/youtu`be-dl
- ln -srv $(DESTDIR)$(BINDIR)/youtube-dl $(DESTDIR)$(BINDIR)/youtu`be-dl
- ln -srv $(DESTDIR)$(LIBDIR)/youtube_dl $(DESTDIR)$(LIBDIR)/youtu`be_dl
|