3 # Allow execution from anywhere
7 sys
.path
.insert(0, os
.path
.dirname(os
.path
.abspath(__file__
)))
13 from setuptools
import Command
, find_packages
, setup
14 setuptools_available
= True
16 from distutils
.core
import Command
, setup
17 setuptools_available
= False
19 from devscripts
.utils
import read_file
, read_version
21 VERSION
= read_version()
23 DESCRIPTION
= 'A youtube-dl fork with additional features and patches'
25 LONG_DESCRIPTION
= '\n\n'.join((
26 'Official repository: <https://github.com/yt-dlp/yt-dlp>',
27 '**PS**: Some links in this document will not work since this is a copy of the README.md from Github',
28 read_file('README.md')))
30 REQUIREMENTS
= read_file('requirements.txt').splitlines()
34 if setuptools_available
:
35 return find_packages(exclude
=('youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins', 'devscripts'))
38 'yt_dlp', 'yt_dlp.extractor', 'yt_dlp.downloader', 'yt_dlp.postprocessor', 'yt_dlp.compat',
44 'py2exe builds do not support pycryptodomex and needs VC++14 to run. '
45 'It is recommended to run "pyinst.py" to build using pyinstaller instead')
49 'script': './yt_dlp/__main__.py',
50 'dest_base': 'yt-dlp',
51 'icon_resources': [(1, 'devscripts/logo.ico')],
55 'description': DESCRIPTION
,
56 'comments': LONG_DESCRIPTION
.split('\n')[0],
57 'product_name': 'yt-dlp',
58 'product_version': VERSION
,
66 # py2exe cannot import Crypto
69 # py2exe appears to confuse this with our socks library.
70 # We don't use pysocks and urllib3.contrib.socks would fail to import if tried.
71 'urllib3.contrib.socks'
73 'dll_excludes': ['w9xpopen.exe', 'crypt32.dll'],
74 # Modules that are only imported dynamically must be added here
75 'includes': ['yt_dlp.compat._legacy', 'yt_dlp.compat._deprecated',
76 'yt_dlp.utils._legacy', 'yt_dlp.utils._deprecated'],
84 ('share/bash-completion/completions', ['completions/bash/yt-dlp']),
85 ('share/zsh/site-functions', ['completions/zsh/_yt-dlp']),
86 ('share/fish/vendor_completions.d', ['completions/fish/yt-dlp.fish']),
87 ('share/doc/yt_dlp', ['README.txt']),
88 ('share/man/man1', ['yt-dlp.1'])
91 for dirname
, files
in files_spec
:
94 if not os
.path
.exists(fn
):
95 warnings
.warn(f
'Skipping file {fn} since it is not present. Try running " make pypi-files " first')
98 data_files
.append((dirname
, resfiles
))
100 params
= {'data_files': data_files}
102 if setuptools_available
:
103 params
['entry_points'] = {
104 'console_scripts': ['yt-dlp = yt_dlp:main'],
105 'pyinstaller40': ['hook-dirs = yt_dlp.__pyinstaller:get_hook_dirs'],
108 params
['scripts'] = ['yt-dlp']
112 class build_lazy_extractors(Command
):
113 description
= 'Build the extractor lazy loading module'
116 def initialize_options(self
):
119 def finalize_options(self
):
124 print('Skipping build of lazy extractors in dry run mode')
126 subprocess
.run([sys
.executable
, 'devscripts/make_lazy_extractors.py'])
130 if sys
.argv
[1:2] == ['py2exe']:
131 params
= py2exe_params()
133 from py2exe
import freeze
135 import py2exe
# noqa: F401
136 warnings
.warn('You are using an outdated version of py2exe. Support for this version will be removed in the future')
137 params
['console'][0].update(params
.pop('version_info'))
138 params
['options'] = {'py2exe': params.pop('options')}
140 return freeze(**params
)
142 params
= build_params()
147 maintainer
='pukkandan',
148 maintainer_email
='pukkandan.ytdlp@gmail.com',
149 description
=DESCRIPTION
,
150 long_description
=LONG_DESCRIPTION
,
151 long_description_content_type
='text/markdown',
152 url
='https://github.com/yt-dlp/yt-dlp',
154 install_requires
=REQUIREMENTS
,
155 python_requires
='>=3.7',
157 'Documentation': 'https://github.com/yt-dlp/yt-dlp#readme',
158 'Source': 'https://github.com/yt-dlp/yt-dlp',
159 'Tracker': 'https://github.com/yt-dlp/yt-dlp/issues',
160 'Funding': 'https://github.com/yt-dlp/yt-dlp/blob/master/Collaborators.md#collaborators',
163 'Topic :: Multimedia :: Video',
164 'Development Status :: 5 - Production/Stable',
165 'Environment :: Console',
166 'Programming Language :: Python',
167 'Programming Language :: Python :: 3.7',
168 'Programming Language :: Python :: 3.8',
169 'Programming Language :: Python :: 3.9',
170 'Programming Language :: Python :: 3.10',
171 'Programming Language :: Python :: 3.11',
172 'Programming Language :: Python :: Implementation',
173 'Programming Language :: Python :: Implementation :: CPython',
174 'Programming Language :: Python :: Implementation :: PyPy',
175 'License :: Public Domain',
176 'Operating System :: OS Independent',
178 cmdclass
={'build_lazy_extractors': build_lazy_extractors}
,