]> jfr.im git - yt-dlp.git/blob - setup.py
[cleanup] Point all shebang to `python3` (#372)
[yt-dlp.git] / setup.py
1 #!/usr/bin/env python3
2 # coding: utf-8
3
4 from setuptools import setup, Command, find_packages
5 import os.path
6 import warnings
7 import sys
8 from distutils.spawn import spawn
9
10
11 # Get the version from yt_dlp/version.py without importing the package
12 exec(compile(open('yt_dlp/version.py').read(), 'yt_dlp/version.py', 'exec'))
13
14
15 DESCRIPTION = 'Command-line program to download videos from YouTube.com and many other other video platforms.'
16
17 LONG_DESCRIPTION = '\n\n'.join((
18 'Official repository: <https://github.com/yt-dlp/yt-dlp>',
19 '**PS**: Some links in this document will not work since this is a copy of the README.md from Github',
20 open('README.md', 'r', encoding='utf-8').read()))
21
22 REQUIREMENTS = ['mutagen', 'pycryptodome']
23
24 if sys.argv[1:2] == ['py2exe']:
25 raise NotImplementedError('py2exe is not currently supported; instead, use "pyinst.py" to build with pyinstaller')
26
27
28 files_spec = [
29 ('share/bash-completion/completions', ['completions/bash/yt-dlp']),
30 ('share/zsh/site-functions', ['completions/zsh/_yt-dlp']),
31 ('share/fish/vendor_completions.d', ['completions/fish/yt-dlp.fish']),
32 ('share/doc/yt_dlp', ['README.txt']),
33 ('share/man/man1', ['yt-dlp.1'])
34 ]
35 root = os.path.dirname(os.path.abspath(__file__))
36 data_files = []
37 for dirname, files in files_spec:
38 resfiles = []
39 for fn in files:
40 if not os.path.exists(fn):
41 warnings.warn('Skipping file %s since it is not present. Try running `make pypi-files` first' % fn)
42 else:
43 resfiles.append(fn)
44 data_files.append((dirname, resfiles))
45
46 params = {
47 'data_files': data_files,
48 }
49 params['entry_points'] = {'console_scripts': ['yt-dlp = yt_dlp:main']}
50
51
52 class build_lazy_extractors(Command):
53 description = 'Build the extractor lazy loading module'
54 user_options = []
55
56 def initialize_options(self):
57 pass
58
59 def finalize_options(self):
60 pass
61
62 def run(self):
63 spawn([sys.executable, 'devscripts/make_lazy_extractors.py', 'yt_dlp/extractor/lazy_extractors.py'],
64 dry_run=self.dry_run)
65
66
67 packages = find_packages(exclude=('youtube_dl', 'test', 'ytdlp_plugins'))
68
69 setup(
70 name='yt-dlp',
71 version=__version__,
72 maintainer='pukkandan',
73 maintainer_email='pukkandan.ytdlp@gmail.com',
74 description=DESCRIPTION,
75 long_description=LONG_DESCRIPTION,
76 long_description_content_type='text/markdown',
77 url='https://github.com/yt-dlp/yt-dlp',
78 packages=packages,
79 install_requires=REQUIREMENTS,
80 project_urls={
81 'Documentation': 'https://yt-dlp.readthedocs.io',
82 'Source': 'https://github.com/yt-dlp/yt-dlp',
83 'Tracker': 'https://github.com/yt-dlp/yt-dlp/issues',
84 #'Funding': 'https://donate.pypi.org',
85 },
86 classifiers=[
87 'Topic :: Multimedia :: Video',
88 'Development Status :: 5 - Production/Stable',
89 'Environment :: Console',
90 'Programming Language :: Python',
91 'Programming Language :: Python :: 3.6',
92 'Programming Language :: Python :: 3.7',
93 'Programming Language :: Python :: 3.8',
94 'Programming Language :: Python :: Implementation',
95 'Programming Language :: Python :: Implementation :: CPython',
96 'Programming Language :: Python :: Implementation :: PyPy',
97 'License :: Public Domain',
98 'Operating System :: OS Independent',
99 ],
100 python_requires='>=3.6',
101
102 cmdclass={'build_lazy_extractors': build_lazy_extractors},
103 **params
104 )