summaryrefslogtreecommitdiffstats
path: root/devscripts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:10:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:10:23 +0000
commit96011c9a0b8a4f10e6e06f76acc380d6a802bbee (patch)
tree30ded50e296e5d936800d19ada594982f10111d6 /devscripts
parentAdding debian version 2024.04.09-1. (diff)
downloadyt-dlp-96011c9a0b8a4f10e6e06f76acc380d6a802bbee.tar.xz
yt-dlp-96011c9a0b8a4f10e6e06f76acc380d6a802bbee.zip
Merging upstream version 2024.05.26.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devscripts')
-rw-r--r--devscripts/changelog_override.json22
-rwxr-xr-xdevscripts/install_deps.py12
-rw-r--r--devscripts/run_tests.bat4
-rwxr-xr-xdevscripts/run_tests.py14
-rwxr-xr-xdevscripts/run_tests.sh4
5 files changed, 41 insertions, 15 deletions
diff --git a/devscripts/changelog_override.json b/devscripts/changelog_override.json
index 046060c..86e8ec2 100644
--- a/devscripts/changelog_override.json
+++ b/devscripts/changelog_override.json
@@ -147,5 +147,27 @@
"action": "add",
"when": "9590cc6b4768e190183d7d071a6c78170889116a",
"short": "[priority] Security: [[CVE-2024-22423](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-22423)] [Prevent RCE when using `--exec` with `%q` on Windows](https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-hjq6-52gw-2g7p)\n - The shell escape function now properly escapes `%`, `\\` and `\\n`.\n - `utils.Popen` has been patched accordingly."
+ },
+ {
+ "action": "change",
+ "when": "41ba4a808b597a3afed78c89675a30deb6844450",
+ "short": "[ie/tiktok] Extract via mobile API only if extractor-arg is passed (#9938)",
+ "authors": ["bashonly"]
+ },
+ {
+ "action": "remove",
+ "when": "6e36d17f404556f0e3a43f441c477a71a91877d9"
+ },
+ {
+ "action": "change",
+ "when": "beaf832c7a9d57833f365ce18f6115b88071b296",
+ "short": "[ie/soundcloud] Add `formats` extractor-arg (#10004)",
+ "authors": ["bashonly", "Grub4K"]
+ },
+ {
+ "action": "change",
+ "when": "5c019f6328ad40d66561eac3c4de0b3cd070d0f6",
+ "short": "[cleanup] Misc (#9765)",
+ "authors": ["bashonly", "Grub4K", "seproDev"]
}
]
diff --git a/devscripts/install_deps.py b/devscripts/install_deps.py
index d33fc63..d292505 100755
--- a/devscripts/install_deps.py
+++ b/devscripts/install_deps.py
@@ -42,17 +42,25 @@ def parse_args():
def main():
args = parse_args()
project_table = parse_toml(read_file(args.input))['project']
+ recursive_pattern = re.compile(rf'{project_table["name"]}\[(?P<group_name>[\w-]+)\]')
optional_groups = project_table['optional-dependencies']
excludes = args.exclude or []
+ def yield_deps(group):
+ for dep in group:
+ if mobj := recursive_pattern.fullmatch(dep):
+ yield from optional_groups.get(mobj.group('group_name'), [])
+ else:
+ yield dep
+
targets = []
if not args.only_optional: # `-o` should exclude 'dependencies' and the 'default' group
targets.extend(project_table['dependencies'])
if 'default' not in excludes: # `--exclude default` should exclude entire 'default' group
- targets.extend(optional_groups['default'])
+ targets.extend(yield_deps(optional_groups['default']))
for include in filter(None, map(optional_groups.get, args.include or [])):
- targets.extend(include)
+ targets.extend(yield_deps(include))
targets = [t for t in targets if re.match(r'[\w-]+', t).group(0).lower() not in excludes]
diff --git a/devscripts/run_tests.bat b/devscripts/run_tests.bat
deleted file mode 100644
index 57b1f4b..0000000
--- a/devscripts/run_tests.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-@echo off
-
->&2 echo run_tests.bat is deprecated. Please use `devscripts/run_tests.py` instead
-python %~dp0run_tests.py %~1
diff --git a/devscripts/run_tests.py b/devscripts/run_tests.py
index 6d638a9..c605aa6 100755
--- a/devscripts/run_tests.py
+++ b/devscripts/run_tests.py
@@ -4,6 +4,7 @@ import argparse
import functools
import os
import re
+import shlex
import subprocess
import sys
from pathlib import Path
@@ -18,6 +19,8 @@ def parse_args():
'test', help='a extractor tests, or one of "core" or "download"', nargs='*')
parser.add_argument(
'-k', help='run a test matching EXPRESSION. Same as "pytest -k"', metavar='EXPRESSION')
+ parser.add_argument(
+ '--pytest-args', help='arguments to passthrough to pytest')
return parser.parse_args()
@@ -26,15 +29,16 @@ def run_tests(*tests, pattern=None, ci=False):
run_download = 'download' in tests
tests = list(map(fix_test_name, tests))
- arguments = ['pytest', '-Werror', '--tb=short']
+ pytest_args = args.pytest_args or os.getenv('HATCH_TEST_ARGS', '')
+ arguments = ['pytest', '-Werror', '--tb=short', *shlex.split(pytest_args)]
if ci:
arguments.append('--color=yes')
+ if pattern:
+ arguments.extend(['-k', pattern])
if run_core:
arguments.extend(['-m', 'not download'])
elif run_download:
arguments.extend(['-m', 'download'])
- elif pattern:
- arguments.extend(['-k', pattern])
else:
arguments.extend(
f'test/test_download.py::TestDownload::test_{test}' for test in tests)
@@ -46,13 +50,13 @@ def run_tests(*tests, pattern=None, ci=False):
pass
arguments = [sys.executable, '-Werror', '-m', 'unittest']
+ if pattern:
+ arguments.extend(['-k', pattern])
if run_core:
print('"pytest" needs to be installed to run core tests', file=sys.stderr, flush=True)
return 1
elif run_download:
arguments.append('test.test_download')
- elif pattern:
- arguments.extend(['-k', pattern])
else:
arguments.extend(
f'test.test_download.TestDownload.test_{test}' for test in tests)
diff --git a/devscripts/run_tests.sh b/devscripts/run_tests.sh
deleted file mode 100755
index 123ceb1..0000000
--- a/devscripts/run_tests.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env sh
-
->&2 echo 'run_tests.sh is deprecated. Please use `devscripts/run_tests.py` instead'
-python3 devscripts/run_tests.py "$1"