17
0

2 Commits

3 changed files with 57 additions and 2 deletions

48
py314.patch Normal file
View File

@@ -0,0 +1,48 @@
From 3d0a9a040ecaa78ce2d39ec76ff5084ee7be6653 Mon Sep 17 00:00:00 2001
From: Scott K Logan <logans@cottsay.net>
Date: Wed, 16 Jul 2025 15:58:09 -0500
Subject: [PATCH] Prefer multiprocessing 'fork' start method if available
The default multiprocessing start method for Linux changed in Python
3.14 from 'fork' to 'forkserver'. Because capturer relies on sharing
file descriptors, only 'fork' can be used. Prefer that start method
specifically (if the platform supports it).
---
capturer/__init__.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/capturer/__init__.py b/capturer/__init__.py
index 407ba26..9f98950 100644
--- a/capturer/__init__.py
+++ b/capturer/__init__.py
@@ -136,6 +136,10 @@ class MultiProcessHelper(object):
def __init__(self):
"""Initialize a :class:`MultiProcessHelper` object."""
self.processes = []
+ try:
+ self.context = multiprocessing.get_context('fork')
+ except ValueError:
+ self.context = multiprocessing.get_context()
def start_child(self, target):
"""
@@ -146,8 +150,8 @@ def start_child(self, target):
:class:`multiprocessing.Event` to be set when the child
process has finished initialization.
"""
- started_event = multiprocessing.Event()
- child_process = multiprocessing.Process(target=target, args=(started_event,))
+ started_event = self.context.Event()
+ child_process = self.context.Process(target=target, args=(started_event,))
self.processes.append(child_process)
child_process.daemon = True
child_process.start()
@@ -309,7 +313,7 @@ def start_capture(self):
# Capture (and most likely relay) stdout/stderr as separate streams.
if self.relay:
# Start the subprocess to relay output.
- self.output_queue = multiprocessing.Queue()
+ self.output_queue = self.context.Queue()
self.start_child(self.merge_loop)
else:
# Disable relaying of output.

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Nov 19 10:09:04 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Add upstream py314.patch to fix build with Python 3.14
-------------------------------------------------------------------
Mon May 29 11:02:20 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-capturer
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -25,6 +25,8 @@ License: MIT
Group: Development/Languages/Python
URL: https://capturer.readthedocs.io
Source: https://files.pythonhosted.org/packages/source/c/capturer/capturer-%{version}.tar.gz
# PATCH-FIX-UPSTREAM https://github.com/xolox/python-capturer/pull/16 Prefer multiprocessing 'fork' start method if available
Patch: py314.patch
BuildRequires: %{python_module humanfriendly >= 8.0}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest >= 3.0.4}
@@ -46,7 +48,7 @@ but definitely won't work on Windows (due to the use of the platform dependent
"pty" module).
%prep
%setup -q -n capturer-%{version}
%autosetup -p1 -n capturer-%{version}
%build
%pyproject_wheel