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.

111 lines
3.2 KiB

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