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