14
0

- Add python_executable.patch (from gh#tkarabela/pysubs2!104) to

use different filenames of Python executable.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pysubs2?expand=0&rev=7
This commit is contained in:
2025-02-20 13:52:16 +00:00
committed by Git OBS Bridge
parent 4004575d97
commit 84e0550cfd
3 changed files with 56 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Feb 20 13:51:37 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Add python_executable.patch (from gh#tkarabela/pysubs2!104) to
use different filenames of Python executable.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Feb 20 12:37:39 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com> Thu Feb 20 12:37:39 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>

View File

@@ -25,7 +25,11 @@ License: MIT
Group: Development/Languages/Python Group: Development/Languages/Python
URL: https://pysubs2.readthedocs.io URL: https://pysubs2.readthedocs.io
Source0: https://files.pythonhosted.org/packages/source/p/pysubs2/pysubs2-%{version}.tar.gz Source0: https://files.pythonhosted.org/packages/source/p/pysubs2/pysubs2-%{version}.tar.gz
# PATCH-FIX-UPSTREAM python_executable.patch gh#tkarabela/pysubs2!104 mcepl@suse.com
# don't hardcode python executable name
Patch0: python_executable.patch
BuildRequires: %{python_module pip} BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel} BuildRequires: %{python_module wheel}
BuildRequires: fdupes BuildRequires: fdupes
@@ -60,7 +64,7 @@ There is a small CLI tool for batch conversion and retiming.
%python_uninstall_alternative pysubs2 %python_uninstall_alternative pysubs2
%check %check
# online tests only %pytest
%files %{python_files} %files %{python_files}
%license LICENSE.txt %license LICENSE.txt

45
python_executable.patch Normal file
View File

@@ -0,0 +1,45 @@
From 42655812b75c21e527dabd6460ea463f34ae23fa Mon Sep 17 00:00:00 2001
From: Alexandre Detiste <alexandre.detiste@gmail.com>
Date: Sat, 15 Feb 2025 16:16:40 +0100
Subject: [PATCH] python is "python3" on Debian (and others ?)
---
tests/test_cli.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: pysubs2-1.8.0/tests/test_cli.py
===================================================================
--- pysubs2-1.8.0.orig/tests/test_cli.py 2024-12-24 12:52:36.000000000 +0100
+++ pysubs2-1.8.0/tests/test_cli.py 2025-02-20 14:51:01.920439196 +0100
@@ -1,3 +1,4 @@
+import sys
from typing import Any
import pysubs2
@@ -49,7 +50,7 @@
def test_srt_to_microdvd_subprocess_pipe() -> None:
- cmd = ["python", "-m", "pysubs2", "--to", "microdvd", "--fps", "1000"]
+ cmd = [sys.executable, "-m", "pysubs2", "--to", "microdvd", "--fps", "1000"]
output = subprocess.check_output(cmd, input=TEST_SRT_FILE, text=True)
assert output.strip() == TEST_MICRODVD_FILE.strip()
@@ -410,7 +411,7 @@
with tempfile.TemporaryDirectory() as temp_dir:
path = op.join(temp_dir, "test.srt")
with open(path, "w+") as in_fp:
- cmd = ["python", "-m", "pysubs2"]
+ cmd = [sys.executable, "-m", "pysubs2"]
p = subprocess.run(cmd, stdin=in_fp, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
assert p.returncode == 1
assert not p.stdout.startswith("usage: pysubs2")
@@ -427,7 +428,7 @@
with open(input_path, "wb") as fp:
fp.write(input_bytes_win1250)
- cmd = ["python", "-m", "pysubs2", "-o", output_dir, input_path]
+ cmd = [sys.executable, "-m", "pysubs2", "-o", output_dir, input_path]
subprocess.check_call(cmd)
with open(output_path, "rb") as fp: