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

Generated by cgit