]> jfr.im git - yt-dlp.git/blame - setup.py
Fix packaging bugs (#129)
[yt-dlp.git] / setup.py
CommitLineData
2f1765c4 1#!/usr/bin/env python
dcdb292f 2# coding: utf-8
2f1765c4 3
58ac65e7 4from setuptools import setup, Command, find_packages
6c57e8a0 5import os.path
6c57e8a0 6import warnings
4efe62a0 7import sys
5a9858bf 8from distutils.spawn import spawn
a32b573c 9
e38df8f9 10
7a5c1cfe
P
11# Get the version from yt_dlp/version.py without importing the package
12exec(compile(open('yt_dlp/version.py').read(),
13 'yt_dlp/version.py', 'exec'))
3d4b08df 14
e38df8f9 15
7bc877a2 16DESCRIPTION = 'Command-line program to download videos from YouTube.com and many other other video platforms.'
17
18LONG_DESCRIPTION = '\n\n'.join((
7a5c1cfe 19 'Official repository: <https://github.com/yt-dlp/yt-dlp>',
7bc877a2 20 '**PS**: Many links in this document will not work since this is a copy of the README.md from Github',
21 open("README.md", "r", encoding="utf-8").read()))
770234af 22
5d25607a 23REQUIREMENTS = ['mutagen', 'pycryptodome']
e38df8f9 24
25
fec89790 26if len(sys.argv) >= 2 and sys.argv[1] == 'py2exe':
94a538fa 27 print("inv")
fec89790 28else:
6c57e8a0 29 files_spec = [
da7f321e 30 ('share/bash-completion/completions', ['completions/bash/yt-dlp']),
31 ('share/zsh/site-functions', ['completions/zsh/_yt-dlp']),
32 ('share/fish/vendor_completions.d', ['completions/fish/yt-dlp.fish']),
7a5c1cfe
P
33 ('share/doc/yt_dlp', ['README.txt']),
34 ('share/man/man1', ['yt-dlp.1'])
6c57e8a0
PH
35 ]
36 root = os.path.dirname(os.path.abspath(__file__))
37 data_files = []
38 for dirname, files in files_spec:
39 resfiles = []
40 for fn in files:
41 if not os.path.exists(fn):
da7f321e 42 warnings.warn('Skipping file %s since it is not present. Try running `make pypi-files` first.' % fn)
6c57e8a0
PH
43 else:
44 resfiles.append(fn)
45 data_files.append((dirname, resfiles))
46
fec89790 47 params = {
6c57e8a0 48 'data_files': data_files,
a5741a3f 49 }
7a5c1cfe 50 params['entry_points'] = {'console_scripts': ['yt-dlp = yt_dlp:main']}
66c935fb 51
a5741a3f 52
5a9858bf 53class build_lazy_extractors(Command):
3d4b08df 54 description = 'Build the extractor lazy loading module'
5a9858bf
JMF
55 user_options = []
56
57 def initialize_options(self):
58 pass
59
60 def finalize_options(self):
61 pass
62
63 def run(self):
64 spawn(
7a5c1cfe 65 [sys.executable, 'devscripts/make_lazy_extractors.py', 'yt_dlp/extractor/lazy_extractors.py'],
5a9858bf
JMF
66 dry_run=self.dry_run,
67 )
68
66c935fb 69
e38df8f9 70packages = find_packages(exclude=("youtube_dl", "test", "ytdlp_plugins"))
66c935fb 71
cc51a7d4 72setup(
7bc877a2 73 name="yt-dlp",
652e7768 74 version=__version__,
7bc877a2 75 maintainer="pukkandan",
7a5c1cfe 76 maintainer_email="pukkandan.ytdlp@gmail.com",
3d4b08df
S
77 description=DESCRIPTION,
78 long_description=LONG_DESCRIPTION,
7bc877a2 79 long_description_content_type="text/markdown",
7a5c1cfe 80 url="https://github.com/yt-dlp/yt-dlp",
66c935fb 81 packages=packages,
e38df8f9 82 install_requires=REQUIREMENTS,
7bc877a2 83 project_urls={
0744a815 84 'Documentation': 'https://yt-dlp.readthedocs.io',
7a5c1cfe
P
85 'Source': 'https://github.com/yt-dlp/yt-dlp',
86 'Tracker': 'https://github.com/yt-dlp/yt-dlp/issues',
7bc877a2 87 #'Funding': 'https://donate.pypi.org',
88 },
652e7768 89 classifiers=[
359d6d86 90 "Topic :: Multimedia :: Video",
94a538fa
U
91 "Development Status :: 5 - Production/Stable",
92 "Environment :: Console",
93 "Programming Language :: Python",
94 "Programming Language :: Python :: 2",
95 "Programming Language :: Python :: 2.6",
96 "Programming Language :: Python :: 2.7",
97 "Programming Language :: Python :: 3",
98 "Programming Language :: Python :: 3.2",
99 "Programming Language :: Python :: 3.3",
100 "Programming Language :: Python :: 3.4",
101 "Programming Language :: Python :: 3.5",
102 "Programming Language :: Python :: 3.6",
103 "Programming Language :: Python :: 3.7",
104 "Programming Language :: Python :: 3.8",
105 "Programming Language :: Python :: Implementation",
106 "Programming Language :: Python :: Implementation :: CPython",
107 "Programming Language :: Python :: Implementation :: IronPython",
108 "Programming Language :: Python :: Implementation :: Jython",
109 "Programming Language :: Python :: Implementation :: PyPy",
110 "License :: Public Domain",
111 "Operating System :: OS Independent",
a5741a3f 112 ],
94a538fa 113 python_requires='>=2.6',
359d6d86 114
115 cmdclass={'build_lazy_extractors': build_lazy_extractors},
fec89790 116 **params
6515018d 117)