8 from setuptools
import Command
, find_packages
, setup
9 setuptools_available
= True
11 from distutils
.core
import Command
, setup
12 setuptools_available
= False
13 from distutils
.spawn
import spawn
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()
39 if sys
.argv
[1:2] == ['py2exe']:
40 import py2exe
# noqa: F401
42 'py2exe builds do not support pycryptodomex and needs VC++14 to run. '
43 'The recommended way is to use "pyinst.py" to build using pyinstaller')
46 'script': './yt_dlp/__main__.py',
47 'dest_base': 'yt-dlp',
49 'description': DESCRIPTION
,
50 'comments': LONG_DESCRIPTION
.split('\n')[0],
51 'product_name': 'yt-dlp',
52 'product_version': VERSION
,
60 'excludes': ['Crypto', 'Cryptodome'], # py2exe cannot import Crypto
61 'dll_excludes': ['w9xpopen.exe', 'crypt32.dll'],
62 # Modules that are only imported dynamically must be added here
63 'includes': ['yt_dlp.compat._legacy'],
71 ('share/bash-completion/completions', ['completions/bash/yt-dlp']),
72 ('share/zsh/site-functions', ['completions/zsh/_yt-dlp']),
73 ('share/fish/vendor_completions.d', ['completions/fish/yt-dlp.fish']),
74 ('share/doc/yt_dlp', ['README.txt']),
75 ('share/man/man1', ['yt-dlp.1'])
77 root
= os
.path
.dirname(os
.path
.abspath(__file__
))
79 for dirname
, files
in files_spec
:
82 if not os
.path
.exists(fn
):
83 warnings
.warn('Skipping file %s since it is not present. Try running `make pypi-files` first' % fn
)
86 data_files
.append((dirname
, resfiles
))
89 'data_files': data_files
,
92 if setuptools_available
:
93 params
['entry_points'] = {'console_scripts': ['yt-dlp = yt_dlp:main']}
95 params
['scripts'] = ['yt-dlp']
98 class build_lazy_extractors(Command
):
99 description
= 'Build the extractor lazy loading module'
102 def initialize_options(self
):
105 def finalize_options(self
):
109 spawn([sys
.executable
, 'devscripts/make_lazy_extractors.py', 'yt_dlp/extractor/lazy_extractors.py'],
110 dry_run
=self
.dry_run
)
113 if setuptools_available
:
114 packages
= find_packages(exclude
=('youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins'))
116 packages
= ['yt_dlp', 'yt_dlp.downloader', 'yt_dlp.extractor', 'yt_dlp.postprocessor']
122 maintainer
='pukkandan',
123 maintainer_email
='pukkandan.ytdlp@gmail.com',
124 description
=DESCRIPTION
,
125 long_description
=LONG_DESCRIPTION
,
126 long_description_content_type
='text/markdown',
127 url
='https://github.com/yt-dlp/yt-dlp',
129 install_requires
=REQUIREMENTS
,
131 'Documentation': 'https://github.com/yt-dlp/yt-dlp#readme',
132 'Source': 'https://github.com/yt-dlp/yt-dlp',
133 'Tracker': 'https://github.com/yt-dlp/yt-dlp/issues',
134 'Funding': 'https://github.com/yt-dlp/yt-dlp/blob/master/Collaborators.md#collaborators',
137 'Topic :: Multimedia :: Video',
138 'Development Status :: 5 - Production/Stable',
139 'Environment :: Console',
140 'Programming Language :: Python',
141 'Programming Language :: Python :: 3.6',
142 'Programming Language :: Python :: 3.7',
143 'Programming Language :: Python :: 3.8',
144 'Programming Language :: Python :: 3.9',
145 'Programming Language :: Python :: 3.10',
146 'Programming Language :: Python :: 3.11',
147 'Programming Language :: Python :: Implementation',
148 'Programming Language :: Python :: Implementation :: CPython',
149 'Programming Language :: Python :: Implementation :: PyPy',
150 'License :: Public Domain',
151 'Operating System :: OS Independent',
153 python_requires
='>=3.6',
155 cmdclass
={'build_lazy_extractors': build_lazy_extractors}
,