]>
Commit | Line | Data |
---|---|---|
cc52de43 | 1 | #!/usr/bin/env python3 |
dcdb292f | 2 | # coding: utf-8 |
6c57e8a0 | 3 | import os.path |
6c57e8a0 | 4 | import warnings |
4efe62a0 | 5 | import sys |
a32b573c | 6 | |
5d535b4a | 7 | try: |
8 | from setuptools import setup, Command, find_packages | |
9 | setuptools_available = True | |
10 | except ImportError: | |
11 | from distutils.core import setup, Command | |
12 | setuptools_available = False | |
13 | from distutils.spawn import spawn | |
e38df8f9 | 14 | |
7a5c1cfe | 15 | # Get the version from yt_dlp/version.py without importing the package |
cc1dfc93 | 16 | exec(compile(open('yt_dlp/version.py').read(), 'yt_dlp/version.py', 'exec')) |
3d4b08df | 17 | |
e38df8f9 | 18 | |
96565c7e | 19 | DESCRIPTION = 'A youtube-dl fork with additional features and patches' |
7bc877a2 | 20 | |
21 | LONG_DESCRIPTION = '\n\n'.join(( | |
7a5c1cfe | 22 | 'Official repository: <https://github.com/yt-dlp/yt-dlp>', |
cc1dfc93 | 23 | '**PS**: Some links in this document will not work since this is a copy of the README.md from Github', |
e28f1c0a | 24 | open('README.md', 'r', encoding='utf-8').read())) |
770234af | 25 | |
4390d5ec | 26 | REQUIREMENTS = open('requirements.txt').read().splitlines() |
e38df8f9 | 27 | |
5d535b4a | 28 | |
cc1dfc93 | 29 | if sys.argv[1:2] == ['py2exe']: |
5d535b4a | 30 | import py2exe |
31 | warnings.warn( | |
386cdfdb | 32 | 'py2exe builds do not support pycryptodomex and needs VC++14 to run. ' |
5d535b4a | 33 | 'The recommended way is to use "pyinst.py" to build using pyinstaller') |
34 | params = { | |
35 | 'console': [{ | |
36 | 'script': './yt_dlp/__main__.py', | |
37 | 'dest_base': 'yt-dlp', | |
38 | 'version': __version__, | |
39 | 'description': DESCRIPTION, | |
40 | 'comments': LONG_DESCRIPTION.split('\n')[0], | |
41 | 'product_name': 'yt-dlp', | |
42 | 'product_version': __version__, | |
43 | }], | |
44 | 'options': { | |
45 | 'py2exe': { | |
46 | 'bundle_files': 0, | |
47 | 'compressed': 1, | |
48 | 'optimize': 2, | |
49 | 'dist_dir': './dist', | |
50 | 'excludes': ['Crypto', 'Cryptodome'], # py2exe cannot import Crypto | |
51 | 'dll_excludes': ['w9xpopen.exe', 'crypt32.dll'], | |
52 | } | |
53 | }, | |
54 | 'zipfile': None | |
55 | } | |
56 | ||
57 | else: | |
58 | files_spec = [ | |
59 | ('share/bash-completion/completions', ['completions/bash/yt-dlp']), | |
60 | ('share/zsh/site-functions', ['completions/zsh/_yt-dlp']), | |
61 | ('share/fish/vendor_completions.d', ['completions/fish/yt-dlp.fish']), | |
62 | ('share/doc/yt_dlp', ['README.txt']), | |
63 | ('share/man/man1', ['yt-dlp.1']) | |
64 | ] | |
65 | root = os.path.dirname(os.path.abspath(__file__)) | |
66 | data_files = [] | |
67 | for dirname, files in files_spec: | |
68 | resfiles = [] | |
69 | for fn in files: | |
70 | if not os.path.exists(fn): | |
71 | warnings.warn('Skipping file %s since it is not present. Try running `make pypi-files` first' % fn) | |
72 | else: | |
73 | resfiles.append(fn) | |
74 | data_files.append((dirname, resfiles)) | |
75 | ||
76 | params = { | |
77 | 'data_files': data_files, | |
78 | } | |
79 | ||
80 | if setuptools_available: | |
81 | params['entry_points'] = {'console_scripts': ['yt-dlp = yt_dlp:main']} | |
82 | else: | |
83 | params['scripts'] = ['yt-dlp'] | |
66c935fb | 84 | |
a5741a3f | 85 | |
5a9858bf | 86 | class build_lazy_extractors(Command): |
3d4b08df | 87 | description = 'Build the extractor lazy loading module' |
5a9858bf JMF |
88 | user_options = [] |
89 | ||
90 | def initialize_options(self): | |
91 | pass | |
92 | ||
93 | def finalize_options(self): | |
94 | pass | |
95 | ||
96 | def run(self): | |
cc1dfc93 | 97 | spawn([sys.executable, 'devscripts/make_lazy_extractors.py', 'yt_dlp/extractor/lazy_extractors.py'], |
98 | dry_run=self.dry_run) | |
5a9858bf | 99 | |
66c935fb | 100 | |
5d535b4a | 101 | if setuptools_available: |
102 | packages = find_packages(exclude=('youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins')) | |
103 | else: | |
104 | packages = ['yt_dlp', 'yt_dlp.downloader', 'yt_dlp.extractor', 'yt_dlp.postprocessor'] | |
105 | ||
66c935fb | 106 | |
cc51a7d4 | 107 | setup( |
e28f1c0a | 108 | name='yt-dlp', |
652e7768 | 109 | version=__version__, |
e28f1c0a | 110 | maintainer='pukkandan', |
111 | maintainer_email='pukkandan.ytdlp@gmail.com', | |
3d4b08df S |
112 | description=DESCRIPTION, |
113 | long_description=LONG_DESCRIPTION, | |
e28f1c0a | 114 | long_description_content_type='text/markdown', |
115 | url='https://github.com/yt-dlp/yt-dlp', | |
66c935fb | 116 | packages=packages, |
e38df8f9 | 117 | install_requires=REQUIREMENTS, |
7bc877a2 | 118 | project_urls={ |
0744a815 | 119 | 'Documentation': 'https://yt-dlp.readthedocs.io', |
7a5c1cfe P |
120 | 'Source': 'https://github.com/yt-dlp/yt-dlp', |
121 | 'Tracker': 'https://github.com/yt-dlp/yt-dlp/issues', | |
b5ae35ee | 122 | 'Funding': 'https://github.com/yt-dlp/yt-dlp/blob/master/Collaborators.md#collaborators', |
7bc877a2 | 123 | }, |
652e7768 | 124 | classifiers=[ |
e28f1c0a | 125 | 'Topic :: Multimedia :: Video', |
126 | 'Development Status :: 5 - Production/Stable', | |
127 | 'Environment :: Console', | |
128 | 'Programming Language :: Python', | |
e28f1c0a | 129 | 'Programming Language :: Python :: 3.6', |
130 | 'Programming Language :: Python :: 3.7', | |
131 | 'Programming Language :: Python :: 3.8', | |
132 | 'Programming Language :: Python :: Implementation', | |
133 | 'Programming Language :: Python :: Implementation :: CPython', | |
e28f1c0a | 134 | 'Programming Language :: Python :: Implementation :: PyPy', |
135 | 'License :: Public Domain', | |
136 | 'Operating System :: OS Independent', | |
a5741a3f | 137 | ], |
14b17a55 | 138 | python_requires='>=3.6', |
359d6d86 | 139 | |
140 | cmdclass={'build_lazy_extractors': build_lazy_extractors}, | |
fec89790 | 141 | **params |
6515018d | 142 | ) |