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