You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.2 KiB

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