]> jfr.im git - yt-dlp.git/blame - setup.py
[youtube] Prefer info from YouTube than _formats (#8293)
[yt-dlp.git] / setup.py
CommitLineData
2f1765c4
FV
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
01c62591 4from __future__ import print_function
e646ffe7 5
6c57e8a0 6import os.path
6c57e8a0 7import warnings
4efe62a0 8import sys
cc51a7d4 9
a32b573c
DC
10try:
11 from setuptools import setup
f4441536 12 setuptools_available = True
a32b573c
DC
13except ImportError:
14 from distutils.core import setup
369a759a 15 setuptools_available = False
a32b573c 16
fec89790 17try:
131842bb
RB
18 # This will create an exe that needs Microsoft Visual C++ 2008
19 # Redistributable Package
fec89790 20 import py2exe
fec89790
FV
21except ImportError:
22 if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
23 print("Cannot import py2exe", file=sys.stderr)
24 exit(1)
25
cc51a7d4 26py2exe_options = {
770234af
FV
27 "bundle_files": 1,
28 "compressed": 1,
29 "optimize": 2,
30 "dist_dir": '.',
dae69640 31 "dll_excludes": ['w9xpopen.exe', 'crypt32.dll'],
770234af 32}
d055fe4c 33
cc51a7d4 34py2exe_console = [{
a5741a3f 35 "script": "./youtube_dl/__main__.py",
770234af
FV
36 "dest_base": "youtube-dl",
37}]
d055fe4c 38
fec89790
FV
39py2exe_params = {
40 'console': py2exe_console,
d055fe4c 41 'options': {"py2exe": py2exe_options},
fec89790
FV
42 'zipfile': None
43}
770234af 44
fec89790
FV
45if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
46 params = py2exe_params
47else:
6c57e8a0
PH
48 files_spec = [
49 ('etc/bash_completion.d', ['youtube-dl.bash-completion']),
56d1912f 50 ('etc/fish/completions', ['youtube-dl.fish']),
6c57e8a0
PH
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
fec89790 65 params = {
6c57e8a0 66 'data_files': data_files,
a5741a3f 67 }
f4441536
JMF
68 if setuptools_available:
69 params['entry_points'] = {'console_scripts': ['youtube-dl = youtube_dl:main']}
70 else:
71 params['scripts'] = ['bin/youtube-dl']
a5741a3f
FV
72
73# Get the version from youtube_dl/version.py without importing the package
d055fe4c
RB
74exec(compile(open('youtube_dl/version.py').read(),
75 'youtube_dl/version.py', 'exec'))
87bec4c7 76
cc51a7d4 77setup(
652e7768
RB
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',
284acd57 85 author_email='ytdl@yt-dl.org',
652e7768
RB
86 maintainer='Philipp Hagemeister',
87 maintainer_email='phihag@phihag.de',
56327689
PH
88 packages=[
89 'youtube_dl',
90 'youtube_dl.extractor', 'youtube_dl.downloader',
91 'youtube_dl.postprocessor'],
53e89361 92
a5741a3f 93 # Provokes warning on most systems (why?!)
652e7768
RB
94 # test_suite = 'nose.collector',
95 # test_requires = ['nosetest'],
770234af 96
652e7768 97 classifiers=[
2f1765c4
FV
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",
a03aaaed
PH
105 "Programming Language :: Python :: 3.2",
106 "Programming Language :: Python :: 3.3",
107 "Programming Language :: Python :: 3.4",
a5741a3f
FV
108 ],
109
fec89790 110 **params
cc51a7d4 111)