2012-11-30 03:21:19 +09:00
|
|
|
#!/usr/bin/env python
|
2016-10-02 20:39:18 +09:00
|
|
|
# coding: utf-8
|
2012-11-30 03:21:19 +09:00
|
|
|
|
2014-01-05 12:41:49 +09:00
|
|
|
from __future__ import print_function
|
2013-06-24 07:01:41 +09:00
|
|
|
|
2014-01-27 14:22:15 +09:00
|
|
|
import os.path
|
|
|
|
import warnings
|
2012-11-29 02:24:16 +09:00
|
|
|
import sys
|
2012-11-30 00:51:55 +09:00
|
|
|
|
2013-01-30 23:31:38 +09:00
|
|
|
try:
|
2016-03-07 03:36:39 +09:00
|
|
|
from setuptools import setup, Command
|
2013-10-18 20:49:25 +09:00
|
|
|
setuptools_available = True
|
2013-01-30 23:31:38 +09:00
|
|
|
except ImportError:
|
2016-03-07 03:36:39 +09:00
|
|
|
from distutils.core import setup, Command
|
2013-10-29 00:54:38 +09:00
|
|
|
setuptools_available = False
|
2016-03-07 03:36:39 +09:00
|
|
|
from distutils.spawn import spawn
|
2013-01-30 23:31:38 +09:00
|
|
|
|
2012-12-07 20:04:52 +09:00
|
|
|
try:
|
2013-06-26 12:51:27 +09:00
|
|
|
# This will create an exe that needs Microsoft Visual C++ 2008
|
|
|
|
# Redistributable Package
|
2012-12-07 20:04:52 +09:00
|
|
|
import py2exe
|
|
|
|
except ImportError:
|
|
|
|
if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
|
2016-06-25 04:50:12 +09:00
|
|
|
print('Cannot import py2exe', file=sys.stderr)
|
2012-12-07 20:04:52 +09:00
|
|
|
exit(1)
|
|
|
|
|
2012-11-30 00:51:55 +09:00
|
|
|
py2exe_options = {
|
2016-06-25 04:50:12 +09:00
|
|
|
'bundle_files': 1,
|
|
|
|
'compressed': 1,
|
|
|
|
'optimize': 2,
|
|
|
|
'dist_dir': '.',
|
|
|
|
'dll_excludes': ['w9xpopen.exe', 'crypt32.dll'],
|
2012-03-26 06:48:53 +09:00
|
|
|
}
|
2013-06-26 12:53:55 +09:00
|
|
|
|
2016-06-25 04:50:12 +09:00
|
|
|
# Get the version from youtube_dl/version.py without importing the package
|
|
|
|
exec(compile(open('youtube_dl/version.py').read(),
|
|
|
|
'youtube_dl/version.py', 'exec'))
|
|
|
|
|
|
|
|
DESCRIPTION = 'YouTube video downloader'
|
|
|
|
LONG_DESCRIPTION = 'Command-line program to download videos from YouTube.com and other video sites'
|
|
|
|
|
2012-11-30 00:51:55 +09:00
|
|
|
py2exe_console = [{
|
2016-06-25 04:50:12 +09:00
|
|
|
'script': './youtube_dl/__main__.py',
|
|
|
|
'dest_base': 'youtube-dl',
|
|
|
|
'version': __version__,
|
|
|
|
'description': DESCRIPTION,
|
|
|
|
'comments': LONG_DESCRIPTION,
|
|
|
|
'product_name': 'youtube-dl',
|
|
|
|
'product_version': __version__,
|
2012-03-26 06:48:53 +09:00
|
|
|
}]
|
2013-06-26 12:53:55 +09:00
|
|
|
|
2012-12-07 20:04:52 +09:00
|
|
|
py2exe_params = {
|
|
|
|
'console': py2exe_console,
|
2016-06-25 04:50:12 +09:00
|
|
|
'options': {'py2exe': py2exe_options},
|
2012-12-07 20:04:52 +09:00
|
|
|
'zipfile': None
|
|
|
|
}
|
2012-03-26 06:48:53 +09:00
|
|
|
|
2012-12-07 20:04:52 +09:00
|
|
|
if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
|
|
|
|
params = py2exe_params
|
|
|
|
else:
|
2014-01-27 14:22:15 +09:00
|
|
|
files_spec = [
|
|
|
|
('etc/bash_completion.d', ['youtube-dl.bash-completion']),
|
2014-09-14 21:07:33 +09:00
|
|
|
('etc/fish/completions', ['youtube-dl.fish']),
|
2014-01-27 14:22:15 +09:00
|
|
|
('share/doc/youtube_dl', ['README.txt']),
|
|
|
|
('share/man/man1', ['youtube-dl.1'])
|
|
|
|
]
|
|
|
|
root = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
data_files = []
|
|
|
|
for dirname, files in files_spec:
|
|
|
|
resfiles = []
|
|
|
|
for fn in files:
|
|
|
|
if not os.path.exists(fn):
|
|
|
|
warnings.warn('Skipping file %s since it is not present. Type make to build all automatically generated files.' % fn)
|
|
|
|
else:
|
|
|
|
resfiles.append(fn)
|
|
|
|
data_files.append((dirname, resfiles))
|
|
|
|
|
2012-12-07 20:04:52 +09:00
|
|
|
params = {
|
2014-01-27 14:22:15 +09:00
|
|
|
'data_files': data_files,
|
2012-12-07 19:39:08 +09:00
|
|
|
}
|
2013-10-18 20:49:25 +09:00
|
|
|
if setuptools_available:
|
|
|
|
params['entry_points'] = {'console_scripts': ['youtube-dl = youtube_dl:main']}
|
|
|
|
else:
|
|
|
|
params['scripts'] = ['bin/youtube-dl']
|
2012-12-07 19:39:08 +09:00
|
|
|
|
2016-03-07 03:36:39 +09:00
|
|
|
class build_lazy_extractors(Command):
|
2016-06-25 04:50:12 +09:00
|
|
|
description = 'Build the extractor lazy loading module'
|
2016-03-07 03:36:39 +09:00
|
|
|
user_options = []
|
|
|
|
|
|
|
|
def initialize_options(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def finalize_options(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
spawn(
|
|
|
|
[sys.executable, 'devscripts/make_lazy_extractors.py', 'youtube_dl/extractor/lazy_extractors.py'],
|
|
|
|
dry_run=self.dry_run,
|
|
|
|
)
|
|
|
|
|
2012-11-30 00:51:55 +09:00
|
|
|
setup(
|
2013-06-26 12:54:55 +09:00
|
|
|
name='youtube_dl',
|
|
|
|
version=__version__,
|
2016-06-25 04:50:12 +09:00
|
|
|
description=DESCRIPTION,
|
|
|
|
long_description=LONG_DESCRIPTION,
|
2019-03-09 21:14:41 +09:00
|
|
|
url='https://github.com/ytdl-org/youtube-dl',
|
2013-06-26 12:54:55 +09:00
|
|
|
author='Ricardo Garcia',
|
2013-10-19 18:14:20 +09:00
|
|
|
author_email='ytdl@yt-dl.org',
|
2017-02-22 03:51:27 +09:00
|
|
|
maintainer='Sergey M.',
|
|
|
|
maintainer_email='dstftw@gmail.com',
|
2017-12-23 01:38:16 +09:00
|
|
|
license='Unlicense',
|
2014-01-07 13:49:17 +09:00
|
|
|
packages=[
|
|
|
|
'youtube_dl',
|
|
|
|
'youtube_dl.extractor', 'youtube_dl.downloader',
|
|
|
|
'youtube_dl.postprocessor'],
|
2012-03-31 08:19:30 +09:00
|
|
|
|
2012-12-07 19:39:08 +09:00
|
|
|
# Provokes warning on most systems (why?!)
|
2013-06-26 12:54:55 +09:00
|
|
|
# test_suite = 'nose.collector',
|
|
|
|
# test_requires = ['nosetest'],
|
2012-03-26 06:48:53 +09:00
|
|
|
|
2013-06-26 12:54:55 +09:00
|
|
|
classifiers=[
|
2016-06-25 04:50:12 +09:00
|
|
|
'Topic :: Multimedia :: Video',
|
|
|
|
'Development Status :: 5 - Production/Stable',
|
|
|
|
'Environment :: Console',
|
|
|
|
'License :: Public Domain',
|
2018-11-22 04:00:38 +09:00
|
|
|
'Programming Language :: Python',
|
|
|
|
'Programming Language :: Python :: 2',
|
2016-06-25 04:50:12 +09:00
|
|
|
'Programming Language :: Python :: 2.6',
|
|
|
|
'Programming Language :: Python :: 2.7',
|
|
|
|
'Programming Language :: Python :: 3',
|
|
|
|
'Programming Language :: Python :: 3.2',
|
|
|
|
'Programming Language :: Python :: 3.3',
|
|
|
|
'Programming Language :: Python :: 3.4',
|
|
|
|
'Programming Language :: Python :: 3.5',
|
2017-02-22 03:50:34 +09:00
|
|
|
'Programming Language :: Python :: 3.6',
|
2018-11-22 04:00:38 +09:00
|
|
|
'Programming Language :: Python :: 3.7',
|
2018-11-22 04:08:41 +09:00
|
|
|
'Programming Language :: Python :: 3.8',
|
2018-11-22 04:00:38 +09:00
|
|
|
'Programming Language :: Python :: Implementation',
|
|
|
|
'Programming Language :: Python :: Implementation :: CPython',
|
|
|
|
'Programming Language :: Python :: Implementation :: IronPython',
|
|
|
|
'Programming Language :: Python :: Implementation :: Jython',
|
|
|
|
'Programming Language :: Python :: Implementation :: PyPy',
|
2012-12-07 19:39:08 +09:00
|
|
|
],
|
|
|
|
|
2016-03-07 03:36:39 +09:00
|
|
|
cmdclass={'build_lazy_extractors': build_lazy_extractors},
|
2012-12-07 20:04:52 +09:00
|
|
|
**params
|
2012-11-30 00:51:55 +09:00
|
|
|
)
|