setup.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from __future__ import print_function
  4. from glob import glob
  5. import pkg_resources
  6. import sys
  7. try:
  8. from setuptools import setup
  9. except ImportError:
  10. from distutils.core import setup
  11. try:
  12. import py2exe
  13. """This will create an exe that needs Microsoft Visual C++ 2008 Redistributable Package"""
  14. except ImportError:
  15. if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
  16. print("Cannot import py2exe", file=sys.stderr)
  17. exit(1)
  18. py2exe_options = {
  19. "bundle_files": 1,
  20. "compressed": 1,
  21. "optimize": 2,
  22. "dist_dir": '.',
  23. "dll_excludes": ['w9xpopen.exe'],
  24. "includes": [m.replace('\\', '.').replace('/', '.')[:-3]
  25. for m in glob('youtube_dl/*/*.py')]
  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. 'scripts': ['bin/youtube-dl'],
  41. 'data_files': [('etc/bash_completion.d', ['youtube-dl.bash-completion']), # Installing system-wide would require sudo...
  42. ('share/doc/youtube_dl', ['README.txt']),
  43. ('share/man/man1/', ['youtube-dl.1'])]
  44. }
  45. # Get the version from youtube_dl/version.py without importing the package
  46. exec(compile(open('youtube_dl/version.py').read(), 'youtube_dl/version.py', 'exec'))
  47. setup(
  48. name = 'youtube_dl',
  49. version = __version__,
  50. description = 'YouTube video downloader',
  51. long_description = 'Small command-line program to download videos from YouTube.com and other video sites.',
  52. url = 'https://github.com/rg3/youtube-dl',
  53. author = 'Ricardo Garcia',
  54. maintainer = 'Philipp Hagemeister',
  55. maintainer_email = 'phihag@phihag.de',
  56. packages = ['youtube_dl'],
  57. # Provokes warning on most systems (why?!)
  58. #test_suite = 'nose.collector',
  59. #test_requires = ['nosetest'],
  60. classifiers = [
  61. "Topic :: Multimedia :: Video",
  62. "Development Status :: 5 - Production/Stable",
  63. "Environment :: Console",
  64. "License :: Public Domain",
  65. "Programming Language :: Python :: 2.6",
  66. "Programming Language :: Python :: 2.7",
  67. "Programming Language :: Python :: 3",
  68. "Programming Language :: Python :: 3.3"
  69. ],
  70. **params
  71. )