build_exe.py 1019 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from distutils.core import setup
  2. import py2exe
  3. import sys, os
  4. # If run without args, build executables
  5. if len(sys.argv) == 1:
  6. sys.argv.append("py2exe")
  7. os.chdir(os.path.dirname(sys.argv[0]))
  8. sys.path.append('./youtube_dl')
  9. options = {
  10. "bundle_files": 1,
  11. "compressed": 1,
  12. "optimize": 2,
  13. "dist_dir": '.',
  14. "dll_excludes": ['w9xpopen.exe']
  15. }
  16. console = [{
  17. "script":"./youtube_dl/__main__.py",
  18. "dest_base": "youtube-dl",
  19. }]
  20. init_file = open('./youtube_dl/__init__.py')
  21. for line in init_file.readlines():
  22. if line.startswith('__version__'):
  23. version = line[11:].strip(" ='\n")
  24. break
  25. else:
  26. version = ''
  27. setup(name='youtube-dl',
  28. version=version,
  29. description='Small command-line program to download videos from YouTube.com and other video sites',
  30. url='https://github.com/rg3/youtube-dl',
  31. packages=['youtube_dl'],
  32. console = console,
  33. options = {"py2exe": options},
  34. zipfile = None,
  35. )
  36. import shutil
  37. shutil.rmtree("build")