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