git: a76f826dc05f - main - www/yt-dlp: Simplify patches

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Wed, 22 Jun 2022 02:02:42 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a76f826dc05fdd6ed29b8b38b45e223562f1f21c

commit a76f826dc05fdd6ed29b8b38b45e223562f1f21c
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-06-22 02:00:51 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-06-22 02:00:51 +0000

    www/yt-dlp: Simplify patches
    
    -U now refuses to work and recommends to use the package manager
    instead of being patched out entirely.
---
 www/yt-dlp/Makefile                            |  1 +
 www/yt-dlp/files/patch-yt__dlp_____init____.py | 32 --------------------------
 www/yt-dlp/files/patch-yt__dlp_options.py      | 13 -----------
 www/yt-dlp/files/patch-yt__dlp_update.py       | 13 +++++++++++
 4 files changed, 14 insertions(+), 45 deletions(-)

diff --git a/www/yt-dlp/Makefile b/www/yt-dlp/Makefile
index 39c1d711bfd1..8200cfe7b481 100644
--- a/www/yt-dlp/Makefile
+++ b/www/yt-dlp/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	yt-dlp
 DISTVERSION=	2022.06.22.1
+PORTREVISION=	1
 CATEGORIES=	www
 
 MAINTAINER=	yuri@FreeBSD.org
diff --git a/www/yt-dlp/files/patch-yt__dlp_____init____.py b/www/yt-dlp/files/patch-yt__dlp_____init____.py
deleted file mode 100644
index 3e4437de00c6..000000000000
--- a/www/yt-dlp/files/patch-yt__dlp_____init____.py
+++ /dev/null
@@ -1,32 +0,0 @@
---- yt_dlp/__init__.py.orig	2022-06-22 00:50:42 UTC
-+++ yt_dlp/__init__.py
-@@ -879,20 +879,20 @@ def _real_main(argv=None):
-         return
- 
-     with YoutubeDL(ydl_opts) as ydl:
--        pre_process = opts.update_self or opts.rm_cachedir
-+        pre_process = opts.rm_cachedir
-         actual_use = all_urls or opts.load_info_filename
- 
-         if opts.rm_cachedir:
-             ydl.cache.remove()
- 
--        updater = Updater(ydl)
--        if opts.update_self and updater.update() and actual_use:
--            if updater.cmd:
--                return updater.restart()
--            # This code is reachable only for zip variant in py < 3.10
--            # It makes sense to exit here, but the old behavior is to continue
--            ydl.report_warning('Restart yt-dlp to use the updated version')
--            # return 100, 'ERROR: The program must exit for the update to complete'
-+        #updater = Updater(ydl)
-+        #if opts.update_self and updater.update() and actual_use:
-+        #    if updater.cmd:
-+        #        return updater.restart()
-+        #    # This code is reachable only for zip variant in py < 3.10
-+        #    # It makes sense to exit here, but the old behavior is to continue
-+        #    ydl.report_warning('Restart yt-dlp to use the updated version')
-+        #    # return 100, 'ERROR: The program must exit for the update to complete'
- 
-         if not actual_use:
-             if pre_process:
diff --git a/www/yt-dlp/files/patch-yt__dlp_options.py b/www/yt-dlp/files/patch-yt__dlp_options.py
deleted file mode 100644
index 7f7fdfb82562..000000000000
--- a/www/yt-dlp/files/patch-yt__dlp_options.py
+++ /dev/null
@@ -1,13 +0,0 @@
---- yt_dlp/options.py.orig	2022-06-22 01:17:57 UTC
-+++ yt_dlp/options.py
-@@ -313,10 +313,6 @@ def create_parser():
-         action='version',
-         help='Print program version and exit')
-     general.add_option(
--        '-U', '--update',
--        action='store_true', dest='update_self',
--        help='Update this program to latest version')
--    general.add_option(
-         '--no-update',
-         action='store_false', dest='update_self',
-         help='Do not update (default)')
diff --git a/www/yt-dlp/files/patch-yt__dlp_update.py b/www/yt-dlp/files/patch-yt__dlp_update.py
new file mode 100644
index 000000000000..605de73d672c
--- /dev/null
+++ b/www/yt-dlp/files/patch-yt__dlp_update.py
@@ -0,0 +1,13 @@
+- this patch prevents -U from updating yt-dlp - it makes it "unrecognized"
+
+--- yt_dlp/update.py.orig	2022-06-22 01:54:04 UTC
++++ yt_dlp/update.py
+@@ -29,7 +29,7 @@ def _get_variant_and_executable_path():
+ 
+     path = os.path.dirname(__file__)
+     if isinstance(__loader__, zipimporter):
+-        return 'zip', os.path.join(path, '..')
++        return 'unknown', os.path.join(path, '..')
+     elif (os.path.basename(sys.argv[0]) in ('__main__.py', '-m')
+           and os.path.exists(os.path.join(path, '../.git/HEAD'))):
+         return 'source', path