g23 1.5 KB

123456789101112131415161718192021222324252627
  1. #Makefile: Point the installer to youtube-dl library, and add library-creater-for-exe-zip-people
  2. youtube_dl.lib:
  3. echo "import sys" > youtube_dl.lib
  4. echo "sys.path.insert(0, '`realpath --relative-to $(LIBDIR) $(BINDIR)`/youtube-dl')" >> youtube_dl.lib
  5. echo "for mod in ('youtube_dl', 'youtu`be_dl'):" >> youtube_dl.lib
  6. echo " if mod in sys.modules.keys(): del sys.modules[mod]" >> youtube_dl.lib
  7. echo "import sys, youtube_dl" >> youtube_dl.lib
  8. echo "sys.modules['youtu`be_dl'] = sys.modules['youtube_dl']" >> youtube_dl.lib
  9. echo "sys.path.pop(0)" >> youtube_dl.lib
  10. install: youtube-dl.1 youtube-dl.bash-completion youtube-dl.zsh youtube-dl.fish
  11. install -d $(DESTDIR)$(BINDIR)
  12. #Create the 'bootstrap script' for loading from the shell
  13. echo '#!/usr/bin/env python' > $(DESTDIR)$(BINDIR)/youtube-dl
  14. echo 'import youtube_dl' >> $(DESTDIR)$(BINDIR)/youtube-dl
  15. echo "if __name__ == '__main__': youtube_dl.main()" >> $(DESTDIR)$(BINDIR)/youtube-dl
  16. chmod 755 $(DESTDIR)$(BINDIR)/youtube-dl
  17. #Install the Python library!
  18. install -d $(DESTDIR)$(LIBDIR)
  19. rm -Rf $(DESTDIR)$(LIBDIR)/youtube_dl/
  20. cp -R youtube_dl/ $(DESTDIR)$(LIBDIR)/youtube_dl/
  21. find $(DESTDIR)$(LIBDIR)/youtube_dl/ -name "*.pyc" -print | xargs rm
  22. chmod -R 755 $(DESTDIR)$(LIBDIR)/youtube_dl/
  23. #Set up symlinks from youtube-dl's equivalent files
  24. rm -Rf $(DESTDIR)$(BINDIR)/youtu`be-dl $(DESTDIR)$(LIBDIR)/youtu`be-dl
  25. ln -srv $(DESTDIR)$(BINDIR)/youtube-dl $(DESTDIR)$(BINDIR)/youtu`be-dl
  26. ln -srv $(DESTDIR)$(LIBDIR)/youtube_dl $(DESTDIR)$(LIBDIR)/youtu`be_dl