From 66c59ddc12b00e43a2363189e1b9cbf8acfeead1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Guzm=C3=A1n?= Date: Sat, 7 Feb 2026 18:48:44 -0600 Subject: [PATCH] yt-dpl: fix missing dependencies and patching cookies usage. --- ...t_for_firefox_based_browser_abrowser.patch | 15 ++++---- ..._parsing_more_lentient_on_python3.12.patch | 35 +++++++++++++++++++ helpers/make-flit-scm | 29 +++++++++++++++ helpers/make-hatchling | 29 +++++++++++++++ helpers/make-python-packaging | 29 +++++++++++++++ helpers/make-python-pathspec | 29 +++++++++++++++ helpers/make-trove-classifiers | 29 +++++++++++++++ helpers/make-yt-dlp | 5 +-- 8 files changed, 190 insertions(+), 10 deletions(-) create mode 100644 helpers/DATA/yt-dlp/patch_changes/002-make_cookies_parsing_more_lentient_on_python3.12.patch create mode 100644 helpers/make-flit-scm create mode 100644 helpers/make-hatchling create mode 100644 helpers/make-python-packaging create mode 100644 helpers/make-python-pathspec create mode 100644 helpers/make-trove-classifiers diff --git a/helpers/DATA/yt-dlp/patch_changes/000-add_cookies_support_for_firefox_based_browser_abrowser.patch b/helpers/DATA/yt-dlp/patch_changes/000-add_cookies_support_for_firefox_based_browser_abrowser.patch index 7f3b9ee..783d516 100644 --- a/helpers/DATA/yt-dlp/patch_changes/000-add_cookies_support_for_firefox_based_browser_abrowser.patch +++ b/helpers/DATA/yt-dlp/patch_changes/000-add_cookies_support_for_firefox_based_browser_abrowser.patch @@ -86,12 +86,15 @@ index 5675445a..7afd324b 100644 if sys.platform in ('cygwin', 'win32'): yield from map(os.path.expandvars, ( R'%APPDATA%\Mozilla\Firefox\Profiles', -@@ -205,7 +205,7 @@ def _firefox_browser_dirs(): - - else: +@@ -214,9 +214,9 @@ def _firefox_browser_dirs(browser_name='firefox'): yield from map(os.path.expanduser, ( + # New installations of FF147+ respect the XDG base directory specification + # Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=259356 +- os.path.join(_config_home(), 'mozilla/firefox'), ++ os.path.join(_config_home(), 'mozilla/{browser_name}'), + # Existing FF version<=146 installations - '~/.mozilla/firefox', -+ f'~/.mozilla/{browser_name}', - '~/snap/firefox/common/.mozilla/firefox', ++ '~/.mozilla/{browser_name}', + # Flatpak XDG: https://docs.flatpak.org/en/latest/conventions.html#xdg-base-directories + '~/.var/app/org.mozilla.firefox/config/mozilla/firefox', '~/.var/app/org.mozilla.firefox/.mozilla/firefox', - )) diff --git a/helpers/DATA/yt-dlp/patch_changes/002-make_cookies_parsing_more_lentient_on_python3.12.patch b/helpers/DATA/yt-dlp/patch_changes/002-make_cookies_parsing_more_lentient_on_python3.12.patch new file mode 100644 index 0000000..895c8f1 --- /dev/null +++ b/helpers/DATA/yt-dlp/patch_changes/002-make_cookies_parsing_more_lentient_on_python3.12.patch @@ -0,0 +1,35 @@ +diff --git a/yt_dlp/cookies.py b/yt_dlp/cookies.py +index 8c05a09f..8b6f6613 100644 +--- a/yt_dlp/cookies.py ++++ b/yt_dlp/cookies.py +@@ -1238,15 +1238,27 @@ def load(self, data): + else: + value, _ = self.value_decode(value) + +- morsel[key] = value ++ try: ++ morsel[key] = value ++ except http.cookies.CookieError: ++ # Lenient mode: ignore invalid attributes ++ pass + + elif is_attribute: + morsel = None + + elif value is not None: +- morsel = self.get(key, http.cookies.Morsel()) ++ morsel = self.get(key) or http.cookies.Morsel() + real_value, coded_value = self.value_decode(value) +- morsel.set(key, real_value, coded_value) ++ try: ++ morsel.set(key, real_value, coded_value) ++ except http.cookies.CookieError: ++ # Python 3.12+ rejects control characters in cookies. ++ # LenientSimpleCookie should accept them (yt-dlp tests expect this), so ++ # bypass Morsel.set() validation, assign underlying fields to read-only props. ++ morsel._key = key ++ morsel._value = real_value ++ morsel._coded_value = coded_value + self[key] = morsel + + else: diff --git a/helpers/make-flit-scm b/helpers/make-flit-scm new file mode 100644 index 0000000..20184fd --- /dev/null +++ b/helpers/make-flit-scm @@ -0,0 +1,29 @@ +#!/bin/sh +# +# Copyright (C) 2026 Luis Guzman +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +VERSION=1 +EXTERNAL='deb-src http://archive.ubuntu.com/ubuntu noble universe' +BACKPORT=true +BUILD_UNTIL=11.0 + +. ./config + + +changelog "Backport dependency for newer yt-dlp" + +package diff --git a/helpers/make-hatchling b/helpers/make-hatchling new file mode 100644 index 0000000..fc127f2 --- /dev/null +++ b/helpers/make-hatchling @@ -0,0 +1,29 @@ +#!/bin/sh +# +# Copyright (C) 2026 Luis Guzman +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +VERSION=1 +EXTERNAL='deb-src http://deb.debian.org/debian trixie main' +REPOKEY=6ED0E7B82643E131 +BACKPORTS=true +BUILD_UNTIL=11.0 + +. ./config + +changelog "Backport dependency for newer yt-dlp" + +package diff --git a/helpers/make-python-packaging b/helpers/make-python-packaging new file mode 100644 index 0000000..fc127f2 --- /dev/null +++ b/helpers/make-python-packaging @@ -0,0 +1,29 @@ +#!/bin/sh +# +# Copyright (C) 2026 Luis Guzman +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +VERSION=1 +EXTERNAL='deb-src http://deb.debian.org/debian trixie main' +REPOKEY=6ED0E7B82643E131 +BACKPORTS=true +BUILD_UNTIL=11.0 + +. ./config + +changelog "Backport dependency for newer yt-dlp" + +package diff --git a/helpers/make-python-pathspec b/helpers/make-python-pathspec new file mode 100644 index 0000000..20184fd --- /dev/null +++ b/helpers/make-python-pathspec @@ -0,0 +1,29 @@ +#!/bin/sh +# +# Copyright (C) 2026 Luis Guzman +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +VERSION=1 +EXTERNAL='deb-src http://archive.ubuntu.com/ubuntu noble universe' +BACKPORT=true +BUILD_UNTIL=11.0 + +. ./config + + +changelog "Backport dependency for newer yt-dlp" + +package diff --git a/helpers/make-trove-classifiers b/helpers/make-trove-classifiers new file mode 100644 index 0000000..20184fd --- /dev/null +++ b/helpers/make-trove-classifiers @@ -0,0 +1,29 @@ +#!/bin/sh +# +# Copyright (C) 2026 Luis Guzman +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +VERSION=1 +EXTERNAL='deb-src http://archive.ubuntu.com/ubuntu noble universe' +BACKPORT=true +BUILD_UNTIL=11.0 + +. ./config + + +changelog "Backport dependency for newer yt-dlp" + +package diff --git a/helpers/make-yt-dlp b/helpers/make-yt-dlp index 885133c..02b9bd6 100644 --- a/helpers/make-yt-dlp +++ b/helpers/make-yt-dlp @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2025 Luis Guzman +# Copyright (C) 2026 Luis Guzman # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -34,9 +34,6 @@ sed -i "/Currently supported/s|are:|are at:|" debian/control apply_patch_changes -echo "> Freeze build until there is new info for javascript dependency." -exit 1 - changelog "Track latest release and remove explicit site listing, redirecting to website author." package