setup.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from __future__ import print_function
  4. import pkg_resources
  5. import sys
  6. try:
  7. from setuptools import setup
  8. setuptools_available = True
  9. except ImportError:
  10. from distutils.core import setup
  11. setuptools_available = False
  12. try:
  13. # This will create an exe that needs Microsoft Visual C++ 2008
  14. # Redistributable Package
  15. import py2exe
  16. except ImportError:
  17. if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
  18. print("Cannot import py2exe", file=sys.stderr)
  19. exit(1)
  20. py2exe_options = {
  21. "bundle_files": 1,
  22. "compressed": 1,
  23. "optimize": 2,
  24. "dist_dir": '.',
  25. "dll_excludes": ['w9xpopen.exe'],
  26. }
  27. py2exe_console = [{
  28. "script": "./youtube_dl/__main__.py",
  29. "dest_base": "youtube-dl",
  30. }]
  31. py2exe_params = {
  32. 'console': py2exe_console,
  33. 'options': {"py2exe": py2exe_options},
  34. 'zipfile': None
  35. }
  36. if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
  37. params = py2exe_params
  38. else:
  39. params = {
  40. 'data_files': [ # Installing system-wide would require sudo...
  41. ('etc/bash_completion.d', ['youtube-dl.bash-completion']),
  42. ('share/doc/youtube_dl', ['README.txt']),
  43. ('share/man/man1', ['youtube-dl.1'])
  44. ]
  45. }
  46. if setuptools_available:
  47. params['entry_points'] = {'console_scripts': ['youtube-dl = youtube_dl:main']}
  48. else:
  49. params['scripts'] = ['bin/youtube-dl']
  50. # Get the version from youtube_dl/version.py without importing the package
  51. exec(compile(open('youtube_dl/version.py').read(),
  52. 'youtube_dl/version.py', 'exec'))
  53. setup(
  54. name='youtube_dl',
  55. version=__version__,
  56. description='YouTube video downloader',
  57. long_description='Small command-line program to download videos from'
  58. ' YouTube.com and other video sites.',
  59. url='https://github.com/rg3/youtube-dl',
  60. author='Ricardo Garcia',
  61. author_email='ytdl@yt-dl.org',
  62. maintainer='Philipp Hagemeister',
  63. maintainer_email='phihag@phihag.de',
  64. packages=['youtube_dl', 'youtube_dl.extractor'],
  65. # Provokes warning on most systems (why?!)
  66. # test_suite = 'nose.collector',
  67. # test_requires = ['nosetest'],
  68. classifiers=[
  69. "Topic :: Multimedia :: Video",
  70. "Development Status :: 5 - Production/Stable",
  71. "Environment :: Console",
  72. "License :: Public Domain",
  73. "Programming Language :: Python :: 2.6",
  74. "Programming Language :: Python :: 2.7",
  75. "Programming Language :: Python :: 3",
  76. "Programming Language :: Python :: 3.3"
  77. ],
  78. **params
  79. )