]>
Commit | Line | Data |
---|---|---|
cc52de43 | 1 | #!/usr/bin/env python3 |
54007a45 | 2 | |
e9df3d42 | 3 | # Allow execution from anywhere |
4 | import os | |
4efe62a0 | 5 | import sys |
e9df3d42 | 6 | |
7 | sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | |
8 | ||
9 | import subprocess | |
a32b573c | 10 | |
5d535b4a | 11 | try: |
f8271158 | 12 | from setuptools import Command, find_packages, setup |
5d535b4a | 13 | setuptools_available = True |
14 | except ImportError: | |
f8271158 | 15 | from distutils.core import Command, setup |
5d535b4a | 16 | setuptools_available = False |
e38df8f9 | 17 | |
115add43 | 18 | from devscripts.utils import read_file, read_version |
c1714454 | 19 | |
1d03633c | 20 | VERSION = read_version(varname='_pkg_version') |
e38df8f9 | 21 | |
96565c7e | 22 | DESCRIPTION = 'A youtube-dl fork with additional features and patches' |
7bc877a2 | 23 | |
24 | LONG_DESCRIPTION = '\n\n'.join(( | |
7a5c1cfe | 25 | 'Official repository: <https://github.com/yt-dlp/yt-dlp>', |
cc1dfc93 | 26 | '**PS**: Some links in this document will not work since this is a copy of the README.md from Github', |
115add43 | 27 | read_file('README.md'))) |
770234af | 28 | |
115add43 | 29 | REQUIREMENTS = read_file('requirements.txt').splitlines() |
e38df8f9 | 30 | |
5d535b4a | 31 | |
7b84d6f9 | 32 | def packages(): |
33 | if setuptools_available: | |
460eb9c5 | 34 | return find_packages(exclude=('youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins', 'devscripts')) |
7b84d6f9 | 35 | |
36 | return [ | |
37 | 'yt_dlp', 'yt_dlp.extractor', 'yt_dlp.downloader', 'yt_dlp.postprocessor', 'yt_dlp.compat', | |
7b84d6f9 | 38 | ] |
39 | ||
40 | ||
7b84d6f9 | 41 | def build_params(): |
5d535b4a | 42 | files_spec = [ |
43 | ('share/bash-completion/completions', ['completions/bash/yt-dlp']), | |
44 | ('share/zsh/site-functions', ['completions/zsh/_yt-dlp']), | |
45 | ('share/fish/vendor_completions.d', ['completions/fish/yt-dlp.fish']), | |
46 | ('share/doc/yt_dlp', ['README.txt']), | |
47 | ('share/man/man1', ['yt-dlp.1']) | |
48 | ] | |
5d535b4a | 49 | data_files = [] |
50 | for dirname, files in files_spec: | |
51 | resfiles = [] | |
52 | for fn in files: | |
53 | if not os.path.exists(fn): | |
7b84d6f9 | 54 | warnings.warn(f'Skipping file {fn} since it is not present. Try running " make pypi-files " first') |
5d535b4a | 55 | else: |
56 | resfiles.append(fn) | |
57 | data_files.append((dirname, resfiles)) | |
58 | ||
7b84d6f9 | 59 | params = {'data_files': data_files} |
5d535b4a | 60 | |
61 | if setuptools_available: | |
acb1042a | 62 | params['entry_points'] = { |
63 | 'console_scripts': ['yt-dlp = yt_dlp:main'], | |
64 | 'pyinstaller40': ['hook-dirs = yt_dlp.__pyinstaller:get_hook_dirs'], | |
65 | } | |
5d535b4a | 66 | else: |
67 | params['scripts'] = ['yt-dlp'] | |
7b84d6f9 | 68 | return params |
66c935fb | 69 | |
a5741a3f | 70 | |
5a9858bf | 71 | class build_lazy_extractors(Command): |
3d4b08df | 72 | description = 'Build the extractor lazy loading module' |
5a9858bf JMF |
73 | user_options = [] |
74 | ||
75 | def initialize_options(self): | |
76 | pass | |
77 | ||
78 | def finalize_options(self): | |
79 | pass | |
80 | ||
81 | def run(self): | |
7b84d6f9 | 82 | if self.dry_run: |
83 | print('Skipping build of lazy extractors in dry run mode') | |
84 | return | |
115add43 | 85 | subprocess.run([sys.executable, 'devscripts/make_lazy_extractors.py']) |
5d535b4a | 86 | |
66c935fb | 87 | |
dc3028d2 | 88 | def main(): |
a1b77842 | 89 | params = build_params() |
dc3028d2 | 90 | setup( |
1d03633c | 91 | name='yt-dlp', # package name (do not change/remove comment) |
dc3028d2 S |
92 | version=VERSION, |
93 | maintainer='pukkandan', | |
94 | maintainer_email='pukkandan.ytdlp@gmail.com', | |
95 | description=DESCRIPTION, | |
96 | long_description=LONG_DESCRIPTION, | |
97 | long_description_content_type='text/markdown', | |
98 | url='https://github.com/yt-dlp/yt-dlp', | |
99 | packages=packages(), | |
100 | install_requires=REQUIREMENTS, | |
f4b95aca | 101 | python_requires='>=3.8', |
dc3028d2 S |
102 | project_urls={ |
103 | 'Documentation': 'https://github.com/yt-dlp/yt-dlp#readme', | |
104 | 'Source': 'https://github.com/yt-dlp/yt-dlp', | |
105 | 'Tracker': 'https://github.com/yt-dlp/yt-dlp/issues', | |
106 | 'Funding': 'https://github.com/yt-dlp/yt-dlp/blob/master/Collaborators.md#collaborators', | |
107 | }, | |
108 | classifiers=[ | |
109 | 'Topic :: Multimedia :: Video', | |
110 | 'Development Status :: 5 - Production/Stable', | |
111 | 'Environment :: Console', | |
112 | 'Programming Language :: Python', | |
dc3028d2 S |
113 | 'Programming Language :: Python :: 3.8', |
114 | 'Programming Language :: Python :: 3.9', | |
115 | 'Programming Language :: Python :: 3.10', | |
116 | 'Programming Language :: Python :: 3.11', | |
f4b95aca | 117 | 'Programming Language :: Python :: 3.12', |
dc3028d2 S |
118 | 'Programming Language :: Python :: Implementation', |
119 | 'Programming Language :: Python :: Implementation :: CPython', | |
120 | 'Programming Language :: Python :: Implementation :: PyPy', | |
121 | 'License :: Public Domain', | |
122 | 'Operating System :: OS Independent', | |
123 | ], | |
124 | cmdclass={'build_lazy_extractors': build_lazy_extractors}, | |
125 | **params | |
126 | ) | |
127 | ||
128 | ||
129 | main() |