9 from setuptools
import Command
, find_packages
, setup
10 setuptools_available
= True
12 from distutils
.core
import Command
, setup
13 setuptools_available
= False
17 with open(fname
, encoding
='utf-8') as f
:
21 # Get the version from yt_dlp/version.py without importing the package
22 def read_version(fname
):
23 exec(compile(read(fname
), fname
, 'exec'))
24 return locals()['__version__']
27 VERSION
= read_version('yt_dlp/version.py')
29 DESCRIPTION
= 'A youtube-dl fork with additional features and patches'
31 LONG_DESCRIPTION
= '\n\n'.join((
32 'Official repository: <https://github.com/yt-dlp/yt-dlp>',
33 '**PS**: Some links in this document will not work since this is a copy of the README.md from Github',
36 REQUIREMENTS
= read('requirements.txt').splitlines()
40 if setuptools_available
:
41 return find_packages(exclude
=('youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins'))
44 'yt_dlp', 'yt_dlp.extractor', 'yt_dlp.downloader', 'yt_dlp.postprocessor', 'yt_dlp.compat',
45 'yt_dlp.extractor.anvato_token_generator',
50 import py2exe
# noqa: F401
53 'py2exe builds do not support pycryptodomex and needs VC++14 to run. '
54 'The recommended way is to use "pyinst.py" to build using pyinstaller')
58 'script': './yt_dlp/__main__.py',
59 'dest_base': 'yt-dlp',
61 'description': DESCRIPTION
,
62 'comments': LONG_DESCRIPTION
.split('\n')[0],
63 'product_name': 'yt-dlp',
64 'product_version': VERSION
,
65 'icon_resources': [(1, 'devscripts/logo.ico')],
73 'excludes': ['Crypto', 'Cryptodome'], # py2exe cannot import Crypto
74 'dll_excludes': ['w9xpopen.exe', 'crypt32.dll'],
75 # Modules that are only imported dynamically must be added here
76 'includes': ['yt_dlp.compat._legacy'],
85 ('share/bash-completion/completions', ['completions/bash/yt-dlp']),
86 ('share/zsh/site-functions', ['completions/zsh/_yt-dlp']),
87 ('share/fish/vendor_completions.d', ['completions/fish/yt-dlp.fish']),
88 ('share/doc/yt_dlp', ['README.txt']),
89 ('share/man/man1', ['yt-dlp.1'])
92 for dirname
, files
in files_spec
:
95 if not os
.path
.exists(fn
):
96 warnings
.warn(f
'Skipping file {fn} since it is not present. Try running " make pypi-files " first')
99 data_files
.append((dirname
, resfiles
))
101 params
= {'data_files': data_files}
103 if setuptools_available
:
104 params
['entry_points'] = {'console_scripts': ['yt-dlp = yt_dlp:main']}
106 params
['scripts'] = ['yt-dlp']
110 class build_lazy_extractors(Command
):
111 description
= 'Build the extractor lazy loading module'
114 def initialize_options(self
):
117 def finalize_options(self
):
122 print('Skipping build of lazy extractors in dry run mode')
124 subprocess
.run([sys
.executable
, 'devscripts/make_lazy_extractors.py', 'yt_dlp/extractor/lazy_extractors.py'])
127 params
= py2exe_params() if sys
.argv
[1:2] == ['py2exe'] else build_params()
131 maintainer
='pukkandan',
132 maintainer_email
='pukkandan.ytdlp@gmail.com',
133 description
=DESCRIPTION
,
134 long_description
=LONG_DESCRIPTION
,
135 long_description_content_type
='text/markdown',
136 url
='https://github.com/yt-dlp/yt-dlp',
138 install_requires
=REQUIREMENTS
,
139 python_requires
='>=3.6',
141 'Documentation': 'https://github.com/yt-dlp/yt-dlp#readme',
142 'Source': 'https://github.com/yt-dlp/yt-dlp',
143 'Tracker': 'https://github.com/yt-dlp/yt-dlp/issues',
144 'Funding': 'https://github.com/yt-dlp/yt-dlp/blob/master/Collaborators.md#collaborators',
147 'Topic :: Multimedia :: Video',
148 'Development Status :: 5 - Production/Stable',
149 'Environment :: Console',
150 'Programming Language :: Python',
151 'Programming Language :: Python :: 3.6',
152 'Programming Language :: Python :: 3.7',
153 'Programming Language :: Python :: 3.8',
154 'Programming Language :: Python :: 3.9',
155 'Programming Language :: Python :: 3.10',
156 'Programming Language :: Python :: 3.11',
157 'Programming Language :: Python :: Implementation',
158 'Programming Language :: Python :: Implementation :: CPython',
159 'Programming Language :: Python :: Implementation :: PyPy',
160 'License :: Public Domain',
161 'Operating System :: OS Independent',
163 cmdclass
={'build_lazy_extractors': build_lazy_extractors}
,