mirror of https://github.com/yt-dlp/yt-dlp
Merge branch 'yt-dlp:master' into viu-indonesia-fix-6482-partial
commit
827821d6ca
@ -1,10 +0,0 @@
|
|||||||
include AUTHORS
|
|
||||||
include Changelog.md
|
|
||||||
include LICENSE
|
|
||||||
include README.md
|
|
||||||
include completions/*/*
|
|
||||||
include supportedsites.md
|
|
||||||
include yt-dlp.1
|
|
||||||
include requirements.txt
|
|
||||||
recursive-include devscripts *
|
|
||||||
recursive-include test *
|
|
@ -0,0 +1 @@
|
|||||||
|
# Empty file
|
@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# Allow execution from anywhere
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
from py2exe import freeze
|
||||||
|
|
||||||
|
from devscripts.utils import read_version
|
||||||
|
|
||||||
|
VERSION = read_version()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
warnings.warn(
|
||||||
|
'py2exe builds do not support pycryptodomex and needs VC++14 to run. '
|
||||||
|
'It is recommended to run "pyinst.py" to build using pyinstaller instead')
|
||||||
|
|
||||||
|
return freeze(
|
||||||
|
console=[{
|
||||||
|
'script': './yt_dlp/__main__.py',
|
||||||
|
'dest_base': 'yt-dlp',
|
||||||
|
'icon_resources': [(1, 'devscripts/logo.ico')],
|
||||||
|
}],
|
||||||
|
version_info={
|
||||||
|
'version': VERSION,
|
||||||
|
'description': 'A youtube-dl fork with additional features and patches',
|
||||||
|
'comments': 'Official repository: <https://github.com/yt-dlp/yt-dlp>',
|
||||||
|
'product_name': 'yt-dlp',
|
||||||
|
'product_version': VERSION,
|
||||||
|
},
|
||||||
|
options={
|
||||||
|
'bundle_files': 0,
|
||||||
|
'compressed': 1,
|
||||||
|
'optimize': 2,
|
||||||
|
'dist_dir': './dist',
|
||||||
|
'excludes': [
|
||||||
|
# py2exe cannot import Crypto
|
||||||
|
'Crypto',
|
||||||
|
'Cryptodome',
|
||||||
|
# py2exe appears to confuse this with our socks library.
|
||||||
|
# We don't use pysocks and urllib3.contrib.socks would fail to import if tried.
|
||||||
|
'urllib3.contrib.socks'
|
||||||
|
],
|
||||||
|
'dll_excludes': ['w9xpopen.exe', 'crypt32.dll'],
|
||||||
|
# Modules that are only imported dynamically must be added here
|
||||||
|
'includes': ['yt_dlp.compat._legacy', 'yt_dlp.compat._deprecated',
|
||||||
|
'yt_dlp.utils._legacy', 'yt_dlp.utils._deprecated'],
|
||||||
|
},
|
||||||
|
zipfile=None,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
@ -0,0 +1,66 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# Allow execution from anywhere
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from devscripts.tomlparse import parse_toml
|
||||||
|
from devscripts.utils import read_file
|
||||||
|
|
||||||
|
|
||||||
|
def parse_args():
|
||||||
|
parser = argparse.ArgumentParser(description='Install dependencies for yt-dlp')
|
||||||
|
parser.add_argument(
|
||||||
|
'input', nargs='?', metavar='TOMLFILE', default='pyproject.toml', help='Input file (default: %(default)s)')
|
||||||
|
parser.add_argument(
|
||||||
|
'-e', '--exclude', metavar='REQUIREMENT', action='append', help='Exclude a required dependency')
|
||||||
|
parser.add_argument(
|
||||||
|
'-i', '--include', metavar='GROUP', action='append', help='Include an optional dependency group')
|
||||||
|
parser.add_argument(
|
||||||
|
'-o', '--only-optional', action='store_true', help='Only install optional dependencies')
|
||||||
|
parser.add_argument(
|
||||||
|
'-p', '--print', action='store_true', help='Only print a requirements.txt to stdout')
|
||||||
|
parser.add_argument(
|
||||||
|
'-u', '--user', action='store_true', help='Install with pip as --user')
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args = parse_args()
|
||||||
|
toml_data = parse_toml(read_file(args.input))
|
||||||
|
deps = toml_data['project']['dependencies']
|
||||||
|
targets = deps.copy() if not args.only_optional else []
|
||||||
|
|
||||||
|
for exclude in args.exclude or []:
|
||||||
|
for dep in deps:
|
||||||
|
simplified_dep = re.match(r'[\w-]+', dep)[0]
|
||||||
|
if dep in targets and (exclude.lower() == simplified_dep.lower() or exclude == dep):
|
||||||
|
targets.remove(dep)
|
||||||
|
|
||||||
|
optional_deps = toml_data['project']['optional-dependencies']
|
||||||
|
for include in args.include or []:
|
||||||
|
group = optional_deps.get(include)
|
||||||
|
if group:
|
||||||
|
targets.extend(group)
|
||||||
|
|
||||||
|
if args.print:
|
||||||
|
for target in targets:
|
||||||
|
print(target)
|
||||||
|
return
|
||||||
|
|
||||||
|
pip_args = [sys.executable, '-m', 'pip', 'install', '-U']
|
||||||
|
if args.user:
|
||||||
|
pip_args.append('--user')
|
||||||
|
pip_args.extend(targets)
|
||||||
|
|
||||||
|
return subprocess.call(pip_args)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main())
|
@ -0,0 +1,189 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
"""
|
||||||
|
Simple parser for spec compliant toml files
|
||||||
|
|
||||||
|
A simple toml parser for files that comply with the spec.
|
||||||
|
Should only be used to parse `pyproject.toml` for `install_deps.py`.
|
||||||
|
|
||||||
|
IMPORTANT: INVALID FILES OR MULTILINE STRINGS ARE NOT SUPPORTED!
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
|
WS = r'(?:[\ \t]*)'
|
||||||
|
STRING_RE = re.compile(r'"(?:\\.|[^\\"\n])*"|\'[^\'\n]*\'')
|
||||||
|
SINGLE_KEY_RE = re.compile(rf'{STRING_RE.pattern}|[A-Za-z0-9_-]+')
|
||||||
|
KEY_RE = re.compile(rf'{WS}(?:{SINGLE_KEY_RE.pattern}){WS}(?:\.{WS}(?:{SINGLE_KEY_RE.pattern}){WS})*')
|
||||||
|
EQUALS_RE = re.compile(rf'={WS}')
|
||||||
|
WS_RE = re.compile(WS)
|
||||||
|
|
||||||
|
_SUBTABLE = rf'(?P<subtable>^\[(?P<is_list>\[)?(?P<path>{KEY_RE.pattern})\]\]?)'
|
||||||
|
EXPRESSION_RE = re.compile(rf'^(?:{_SUBTABLE}|{KEY_RE.pattern}=)', re.MULTILINE)
|
||||||
|
|
||||||
|
LIST_WS_RE = re.compile(rf'{WS}((#[^\n]*)?\n{WS})*')
|
||||||
|
LEFTOVER_VALUE_RE = re.compile(r'[^,}\]\t\n#]+')
|
||||||
|
|
||||||
|
|
||||||
|
def parse_key(value: str):
|
||||||
|
for match in SINGLE_KEY_RE.finditer(value):
|
||||||
|
if match[0][0] == '"':
|
||||||
|
yield json.loads(match[0])
|
||||||
|
elif match[0][0] == '\'':
|
||||||
|
yield match[0][1:-1]
|
||||||
|
else:
|
||||||
|
yield match[0]
|
||||||
|
|
||||||
|
|
||||||
|
def get_target(root: dict, paths: list[str], is_list=False):
|
||||||
|
target = root
|
||||||
|
|
||||||
|
for index, key in enumerate(paths, 1):
|
||||||
|
use_list = is_list and index == len(paths)
|
||||||
|
result = target.get(key)
|
||||||
|
if result is None:
|
||||||
|
result = [] if use_list else {}
|
||||||
|
target[key] = result
|
||||||
|
|
||||||
|
if isinstance(result, dict):
|
||||||
|
target = result
|
||||||
|
elif use_list:
|
||||||
|
target = {}
|
||||||
|
result.append(target)
|
||||||
|
else:
|
||||||
|
target = result[-1]
|
||||||
|
|
||||||
|
assert isinstance(target, dict)
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def parse_enclosed(data: str, index: int, end: str, ws_re: re.Pattern):
|
||||||
|
index += 1
|
||||||
|
|
||||||
|
if match := ws_re.match(data, index):
|
||||||
|
index = match.end()
|
||||||
|
|
||||||
|
while data[index] != end:
|
||||||
|
index = yield True, index
|
||||||
|
|
||||||
|
if match := ws_re.match(data, index):
|
||||||
|
index = match.end()
|
||||||
|
|
||||||
|
if data[index] == ',':
|
||||||
|
index += 1
|
||||||
|
|
||||||
|
if match := ws_re.match(data, index):
|
||||||
|
index = match.end()
|
||||||
|
|
||||||
|
assert data[index] == end
|
||||||
|
yield False, index + 1
|
||||||
|
|
||||||
|
|
||||||
|
def parse_value(data: str, index: int):
|
||||||
|
if data[index] == '[':
|
||||||
|
result = []
|
||||||
|
|
||||||
|
indices = parse_enclosed(data, index, ']', LIST_WS_RE)
|
||||||
|
valid, index = next(indices)
|
||||||
|
while valid:
|
||||||
|
index, value = parse_value(data, index)
|
||||||
|
result.append(value)
|
||||||
|
valid, index = indices.send(index)
|
||||||
|
|
||||||
|
return index, result
|
||||||
|
|
||||||
|
if data[index] == '{':
|
||||||
|
result = {}
|
||||||
|
|
||||||
|
indices = parse_enclosed(data, index, '}', WS_RE)
|
||||||
|
valid, index = next(indices)
|
||||||
|
while valid:
|
||||||
|
valid, index = indices.send(parse_kv_pair(data, index, result))
|
||||||
|
|
||||||
|
return index, result
|
||||||
|
|
||||||
|
if match := STRING_RE.match(data, index):
|
||||||
|
return match.end(), json.loads(match[0]) if match[0][0] == '"' else match[0][1:-1]
|
||||||
|
|
||||||
|
match = LEFTOVER_VALUE_RE.match(data, index)
|
||||||
|
assert match
|
||||||
|
value = match[0].strip()
|
||||||
|
for func in [
|
||||||
|
int,
|
||||||
|
float,
|
||||||
|
datetime.time.fromisoformat,
|
||||||
|
datetime.date.fromisoformat,
|
||||||
|
datetime.datetime.fromisoformat,
|
||||||
|
{'true': True, 'false': False}.get,
|
||||||
|
]:
|
||||||
|
try:
|
||||||
|
value = func(value)
|
||||||
|
break
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return match.end(), value
|
||||||
|
|
||||||
|
|
||||||
|
def parse_kv_pair(data: str, index: int, target: dict):
|
||||||
|
match = KEY_RE.match(data, index)
|
||||||
|
if not match:
|
||||||
|
return None
|
||||||
|
|
||||||
|
*keys, key = parse_key(match[0])
|
||||||
|
|
||||||
|
match = EQUALS_RE.match(data, match.end())
|
||||||
|
assert match
|
||||||
|
index = match.end()
|
||||||
|
|
||||||
|
index, value = parse_value(data, index)
|
||||||
|
get_target(target, keys)[key] = value
|
||||||
|
return index
|
||||||
|
|
||||||
|
|
||||||
|
def parse_toml(data: str):
|
||||||
|
root = {}
|
||||||
|
target = root
|
||||||
|
|
||||||
|
index = 0
|
||||||
|
while True:
|
||||||
|
match = EXPRESSION_RE.search(data, index)
|
||||||
|
if not match:
|
||||||
|
break
|
||||||
|
|
||||||
|
if match.group('subtable'):
|
||||||
|
index = match.end()
|
||||||
|
path, is_list = match.group('path', 'is_list')
|
||||||
|
target = get_target(root, list(parse_key(path)), bool(is_list))
|
||||||
|
continue
|
||||||
|
|
||||||
|
index = parse_kv_pair(data, match.start(), target)
|
||||||
|
assert index is not None
|
||||||
|
|
||||||
|
return root
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
import argparse
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('infile', type=Path, help='The TOML file to read as input')
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
with args.infile.open('r', encoding='utf-8') as file:
|
||||||
|
data = file.read()
|
||||||
|
|
||||||
|
def default(obj):
|
||||||
|
if isinstance(obj, (datetime.date, datetime.time, datetime.datetime)):
|
||||||
|
return obj.isoformat()
|
||||||
|
|
||||||
|
print(json.dumps(parse_toml(data), default=default))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
@ -1,5 +1,120 @@
|
|||||||
[build-system]
|
[build-system]
|
||||||
build-backend = 'setuptools.build_meta'
|
requires = ["hatchling"]
|
||||||
# https://github.com/yt-dlp/yt-dlp/issues/5941
|
build-backend = "hatchling.build"
|
||||||
# https://github.com/pypa/distutils/issues/17
|
|
||||||
requires = ['setuptools > 50']
|
[project]
|
||||||
|
name = "yt-dlp"
|
||||||
|
maintainers = [
|
||||||
|
{name = "pukkandan", email = "pukkandan.ytdlp@gmail.com"},
|
||||||
|
{name = "Grub4K", email = "contact@grub4k.xyz"},
|
||||||
|
{name = "bashonly", email = "bashonly@protonmail.com"},
|
||||||
|
]
|
||||||
|
description = "A youtube-dl fork with additional features and patches"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.8"
|
||||||
|
keywords = [
|
||||||
|
"youtube-dl",
|
||||||
|
"video-downloader",
|
||||||
|
"youtube-downloader",
|
||||||
|
"sponsorblock",
|
||||||
|
"youtube-dlc",
|
||||||
|
"yt-dlp",
|
||||||
|
]
|
||||||
|
license = {file = "LICENSE"}
|
||||||
|
classifiers = [
|
||||||
|
"Topic :: Multimedia :: Video",
|
||||||
|
"Development Status :: 5 - Production/Stable",
|
||||||
|
"Environment :: Console",
|
||||||
|
"Programming Language :: Python",
|
||||||
|
"Programming Language :: Python :: 3 :: Only",
|
||||||
|
"Programming Language :: Python :: 3.8",
|
||||||
|
"Programming Language :: Python :: 3.9",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
|
"Programming Language :: Python :: 3.11",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Programming Language :: Python :: Implementation",
|
||||||
|
"Programming Language :: Python :: Implementation :: CPython",
|
||||||
|
"Programming Language :: Python :: Implementation :: PyPy",
|
||||||
|
"License :: OSI Approved :: The Unlicense (Unlicense)",
|
||||||
|
"Operating System :: OS Independent",
|
||||||
|
]
|
||||||
|
dynamic = ["version"]
|
||||||
|
dependencies = [
|
||||||
|
"brotli; implementation_name=='cpython'",
|
||||||
|
"brotlicffi; implementation_name!='cpython'",
|
||||||
|
"certifi",
|
||||||
|
"mutagen",
|
||||||
|
"pycryptodomex",
|
||||||
|
"requests>=2.31.0,<3",
|
||||||
|
"urllib3>=1.26.17,<3",
|
||||||
|
"websockets>=12.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
|
secretstorage = [
|
||||||
|
"cffi",
|
||||||
|
"secretstorage",
|
||||||
|
]
|
||||||
|
build = [
|
||||||
|
"build",
|
||||||
|
"hatchling",
|
||||||
|
"pip",
|
||||||
|
"wheel",
|
||||||
|
]
|
||||||
|
dev = [
|
||||||
|
"flake8",
|
||||||
|
"isort",
|
||||||
|
"pytest",
|
||||||
|
]
|
||||||
|
pyinstaller = ["pyinstaller>=6.3"]
|
||||||
|
py2exe = ["py2exe>=0.12"]
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
Documentation = "https://github.com/yt-dlp/yt-dlp#readme"
|
||||||
|
Repository = "https://github.com/yt-dlp/yt-dlp"
|
||||||
|
Tracker = "https://github.com/yt-dlp/yt-dlp/issues"
|
||||||
|
Funding = "https://github.com/yt-dlp/yt-dlp/blob/master/Collaborators.md#collaborators"
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
yt-dlp = "yt_dlp:main"
|
||||||
|
|
||||||
|
[project.entry-points.pyinstaller40]
|
||||||
|
hook-dirs = "yt_dlp.__pyinstaller:get_hook_dirs"
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.sdist]
|
||||||
|
include = [
|
||||||
|
"/yt_dlp",
|
||||||
|
"/devscripts",
|
||||||
|
"/test",
|
||||||
|
"/.gitignore", # included by default, needed for auto-excludes
|
||||||
|
"/Changelog.md",
|
||||||
|
"/LICENSE", # included as license
|
||||||
|
"/pyproject.toml", # included by default
|
||||||
|
"/README.md", # included as readme
|
||||||
|
"/setup.cfg",
|
||||||
|
"/supportedsites.md",
|
||||||
|
]
|
||||||
|
exclude = ["/yt_dlp/__pyinstaller"]
|
||||||
|
artifacts = [
|
||||||
|
"/yt_dlp/extractor/lazy_extractors.py",
|
||||||
|
"/completions",
|
||||||
|
"/AUTHORS", # included by default
|
||||||
|
"/README.txt",
|
||||||
|
"/yt-dlp.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
packages = ["yt_dlp"]
|
||||||
|
exclude = ["/yt_dlp/__pyinstaller"]
|
||||||
|
artifacts = ["/yt_dlp/extractor/lazy_extractors.py"]
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.wheel.shared-data]
|
||||||
|
"completions/bash/yt-dlp" = "share/bash-completion/completions/yt-dlp"
|
||||||
|
"completions/zsh/_yt-dlp" = "share/zsh/site-functions/_yt-dlp"
|
||||||
|
"completions/fish/yt-dlp.fish" = "share/fish/vendor_completions.d/yt-dlp.fish"
|
||||||
|
"README.txt" = "share/doc/yt_dlp/README.txt"
|
||||||
|
"yt-dlp.1" = "share/man/man1/yt-dlp.1"
|
||||||
|
|
||||||
|
[tool.hatch.version]
|
||||||
|
path = "yt_dlp/version.py"
|
||||||
|
pattern = "_pkg_version = '(?P<version>[^']+)'"
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
mutagen
|
|
||||||
pycryptodomex
|
|
||||||
brotli; implementation_name=='cpython'
|
|
||||||
brotlicffi; implementation_name!='cpython'
|
|
||||||
certifi
|
|
||||||
requests>=2.31.0,<3
|
|
||||||
urllib3>=1.26.17,<3
|
|
||||||
websockets>=12.0
|
|
@ -1,183 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
# Allow execution from anywhere
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
||||||
|
|
||||||
import subprocess
|
|
||||||
import warnings
|
|
||||||
|
|
||||||
try:
|
|
||||||
from setuptools import Command, find_packages, setup
|
|
||||||
setuptools_available = True
|
|
||||||
except ImportError:
|
|
||||||
from distutils.core import Command, setup
|
|
||||||
setuptools_available = False
|
|
||||||
|
|
||||||
from devscripts.utils import read_file, read_version
|
|
||||||
|
|
||||||
VERSION = read_version(varname='_pkg_version')
|
|
||||||
|
|
||||||
DESCRIPTION = 'A youtube-dl fork with additional features and patches'
|
|
||||||
|
|
||||||
LONG_DESCRIPTION = '\n\n'.join((
|
|
||||||
'Official repository: <https://github.com/yt-dlp/yt-dlp>',
|
|
||||||
'**PS**: Some links in this document will not work since this is a copy of the README.md from Github',
|
|
||||||
read_file('README.md')))
|
|
||||||
|
|
||||||
REQUIREMENTS = read_file('requirements.txt').splitlines()
|
|
||||||
|
|
||||||
|
|
||||||
def packages():
|
|
||||||
if setuptools_available:
|
|
||||||
return find_packages(exclude=('youtube_dl', 'youtube_dlc', 'test', 'ytdlp_plugins', 'devscripts'))
|
|
||||||
|
|
||||||
return [
|
|
||||||
'yt_dlp', 'yt_dlp.extractor', 'yt_dlp.downloader', 'yt_dlp.postprocessor', 'yt_dlp.compat',
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def py2exe_params():
|
|
||||||
warnings.warn(
|
|
||||||
'py2exe builds do not support pycryptodomex and needs VC++14 to run. '
|
|
||||||
'It is recommended to run "pyinst.py" to build using pyinstaller instead')
|
|
||||||
|
|
||||||
return {
|
|
||||||
'console': [{
|
|
||||||
'script': './yt_dlp/__main__.py',
|
|
||||||
'dest_base': 'yt-dlp',
|
|
||||||
'icon_resources': [(1, 'devscripts/logo.ico')],
|
|
||||||
}],
|
|
||||||
'version_info': {
|
|
||||||
'version': VERSION,
|
|
||||||
'description': DESCRIPTION,
|
|
||||||
'comments': LONG_DESCRIPTION.split('\n')[0],
|
|
||||||
'product_name': 'yt-dlp',
|
|
||||||
'product_version': VERSION,
|
|
||||||
},
|
|
||||||
'options': {
|
|
||||||
'bundle_files': 0,
|
|
||||||
'compressed': 1,
|
|
||||||
'optimize': 2,
|
|
||||||
'dist_dir': './dist',
|
|
||||||
'excludes': [
|
|
||||||
# py2exe cannot import Crypto
|
|
||||||
'Crypto',
|
|
||||||
'Cryptodome',
|
|
||||||
# py2exe appears to confuse this with our socks library.
|
|
||||||
# We don't use pysocks and urllib3.contrib.socks would fail to import if tried.
|
|
||||||
'urllib3.contrib.socks'
|
|
||||||
],
|
|
||||||
'dll_excludes': ['w9xpopen.exe', 'crypt32.dll'],
|
|
||||||
# Modules that are only imported dynamically must be added here
|
|
||||||
'includes': ['yt_dlp.compat._legacy', 'yt_dlp.compat._deprecated',
|
|
||||||
'yt_dlp.utils._legacy', 'yt_dlp.utils._deprecated'],
|
|
||||||
},
|
|
||||||
'zipfile': None,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def build_params():
|
|
||||||
files_spec = [
|
|
||||||
('share/bash-completion/completions', ['completions/bash/yt-dlp']),
|
|
||||||
('share/zsh/site-functions', ['completions/zsh/_yt-dlp']),
|
|
||||||
('share/fish/vendor_completions.d', ['completions/fish/yt-dlp.fish']),
|
|
||||||
('share/doc/yt_dlp', ['README.txt']),
|
|
||||||
('share/man/man1', ['yt-dlp.1'])
|
|
||||||
]
|
|
||||||
data_files = []
|
|
||||||
for dirname, files in files_spec:
|
|
||||||
resfiles = []
|
|
||||||
for fn in files:
|
|
||||||
if not os.path.exists(fn):
|
|
||||||
warnings.warn(f'Skipping file {fn} since it is not present. Try running " make pypi-files " first')
|
|
||||||
else:
|
|
||||||
resfiles.append(fn)
|
|
||||||
data_files.append((dirname, resfiles))
|
|
||||||
|
|
||||||
params = {'data_files': data_files}
|
|
||||||
|
|
||||||
if setuptools_available:
|
|
||||||
params['entry_points'] = {
|
|
||||||
'console_scripts': ['yt-dlp = yt_dlp:main'],
|
|
||||||
'pyinstaller40': ['hook-dirs = yt_dlp.__pyinstaller:get_hook_dirs'],
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
params['scripts'] = ['yt-dlp']
|
|
||||||
return params
|
|
||||||
|
|
||||||
|
|
||||||
class build_lazy_extractors(Command):
|
|
||||||
description = 'Build the extractor lazy loading module'
|
|
||||||
user_options = []
|
|
||||||
|
|
||||||
def initialize_options(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def finalize_options(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
if self.dry_run:
|
|
||||||
print('Skipping build of lazy extractors in dry run mode')
|
|
||||||
return
|
|
||||||
subprocess.run([sys.executable, 'devscripts/make_lazy_extractors.py'])
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
if sys.argv[1:2] == ['py2exe']:
|
|
||||||
params = py2exe_params()
|
|
||||||
try:
|
|
||||||
from py2exe import freeze
|
|
||||||
except ImportError:
|
|
||||||
import py2exe # noqa: F401
|
|
||||||
warnings.warn('You are using an outdated version of py2exe. Support for this version will be removed in the future')
|
|
||||||
params['console'][0].update(params.pop('version_info'))
|
|
||||||
params['options'] = {'py2exe': params.pop('options')}
|
|
||||||
else:
|
|
||||||
return freeze(**params)
|
|
||||||
else:
|
|
||||||
params = build_params()
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name='yt-dlp', # package name (do not change/remove comment)
|
|
||||||
version=VERSION,
|
|
||||||
maintainer='pukkandan',
|
|
||||||
maintainer_email='pukkandan.ytdlp@gmail.com',
|
|
||||||
description=DESCRIPTION,
|
|
||||||
long_description=LONG_DESCRIPTION,
|
|
||||||
long_description_content_type='text/markdown',
|
|
||||||
url='https://github.com/yt-dlp/yt-dlp',
|
|
||||||
packages=packages(),
|
|
||||||
install_requires=REQUIREMENTS,
|
|
||||||
python_requires='>=3.8',
|
|
||||||
project_urls={
|
|
||||||
'Documentation': 'https://github.com/yt-dlp/yt-dlp#readme',
|
|
||||||
'Source': 'https://github.com/yt-dlp/yt-dlp',
|
|
||||||
'Tracker': 'https://github.com/yt-dlp/yt-dlp/issues',
|
|
||||||
'Funding': 'https://github.com/yt-dlp/yt-dlp/blob/master/Collaborators.md#collaborators',
|
|
||||||
},
|
|
||||||
classifiers=[
|
|
||||||
'Topic :: Multimedia :: Video',
|
|
||||||
'Development Status :: 5 - Production/Stable',
|
|
||||||
'Environment :: Console',
|
|
||||||
'Programming Language :: Python',
|
|
||||||
'Programming Language :: Python :: 3.8',
|
|
||||||
'Programming Language :: Python :: 3.9',
|
|
||||||
'Programming Language :: Python :: 3.10',
|
|
||||||
'Programming Language :: Python :: 3.11',
|
|
||||||
'Programming Language :: Python :: 3.12',
|
|
||||||
'Programming Language :: Python :: Implementation',
|
|
||||||
'Programming Language :: Python :: Implementation :: CPython',
|
|
||||||
'Programming Language :: Python :: Implementation :: PyPy',
|
|
||||||
'License :: Public Domain',
|
|
||||||
'Operating System :: OS Independent',
|
|
||||||
],
|
|
||||||
cmdclass={'build_lazy_extractors': build_lazy_extractors},
|
|
||||||
**params
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
main()
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue