]>
Commit | Line | Data |
---|---|---|
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=['youtube_dl', 'youtube_dl.extractor', 'youtube_dl.downloader'], | |
75 | ||
76 | # Provokes warning on most systems (why?!) | |
77 | # test_suite = 'nose.collector', | |
78 | # test_requires = ['nosetest'], | |
79 | ||
80 | classifiers=[ | |
81 | "Topic :: Multimedia :: Video", | |
82 | "Development Status :: 5 - Production/Stable", | |
83 | "Environment :: Console", | |
84 | "License :: Public Domain", | |
85 | "Programming Language :: Python :: 2.6", | |
86 | "Programming Language :: Python :: 2.7", | |
87 | "Programming Language :: Python :: 3", | |
88 | "Programming Language :: Python :: 3.3" | |
89 | ], | |
90 | ||
91 | **params | |
92 | ) |