setup.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. import subprocess
  9. """The p2exe option will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package.
  10. python setup.py py2exe
  11. You can also build a zip executable with
  12. python setup.py bdist --format=zip
  13. """
  14. # If run without args, build executables
  15. if len(sys.argv) == 1:
  16. sys.argv.append("py2exe")
  17. # os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) # conflict with wine-py2exe.sh
  18. #sys.path.append('./youtube_dl')
  19. options = {
  20. "bundle_files": 1,
  21. "compressed": 1,
  22. "optimize": 2,
  23. "dist_dir": '.',
  24. "dll_excludes": ['w9xpopen.exe']
  25. }
  26. console = [{
  27. "script":"./youtube_dl/__main__.py",
  28. "dest_base": "youtube-dl",
  29. }]
  30. init_file = open('./youtube_dl/__init__.py')
  31. try:
  32. version = subprocess.checkoutput(["git", "describe", "--abbrev=0", "--tags"])
  33. except:
  34. version = ''
  35. setup(name='youtube-dl',
  36. version=version,
  37. description='Small command-line program to download videos from YouTube.com and other video sites',
  38. url='https://github.com/rg3/youtube-dl',
  39. packages=['youtube_dl'],
  40. console = console,
  41. options = {"py2exe": options},
  42. zipfile = None,
  43. )
  44. import shutil
  45. shutil.rmtree("build")