- Add patch support-python-314.patch:

* Support Python 3.14 asyncio changes.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-fire?expand=0&rev=33
This commit is contained in:
2025-10-29 01:10:03 +00:00
committed by Git OBS Bridge
parent 7ff4b88e91
commit d5caee59df
3 changed files with 73 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Oct 29 01:09:09 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-python-314.patch:
* Support Python 3.14 asyncio changes.
-------------------------------------------------------------------
Wed Sep 17 12:04:56 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-fire
#
# Copyright (c) 2025 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
@@ -15,6 +15,7 @@
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-fire
Version: 0.7.1
@@ -23,6 +24,8 @@ Summary: A library for automatically generating command line interfaces
License: Apache-2.0
URL: https://github.com/google/python-fire
Source: https://files.pythonhosted.org/packages/source/f/fire/fire-%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#google/python-fire#623
Patch0: support-python-314.patch
# Based on https://github.com/google/python-fire/pull/265/files
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module pip}

63
support-python-314.patch Normal file
View File

@@ -0,0 +1,63 @@
From 1aa72a66acd4e9dc421deb5523a429f9f4519421 Mon Sep 17 00:00:00 2001
From: David Bieber <david810@gmail.com>
Date: Sat, 16 Aug 2025 16:42:23 -0400
Subject: [PATCH 1/4] Add Python 3.13 and 3.14 checking in build workflow
---
.github/workflows/build.yml | 2 +-
pyproject.toml | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
Index: fire-0.7.1/pyproject.toml
===================================================================
--- fire-0.7.1.orig/pyproject.toml
+++ fire-0.7.1/pyproject.toml
@@ -24,6 +24,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
+ "Programming Language :: Python :: 3.14",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: MacOS",
Index: fire-0.7.1/fire/core.py
===================================================================
--- fire-0.7.1.orig/fire/core.py
+++ fire-0.7.1/fire/core.py
@@ -678,8 +678,14 @@ def _CallAndUpdateTrace(component, args,
# Call the function.
if inspectutils.IsCoroutineFunction(fn):
- loop = asyncio.get_event_loop()
- component = loop.run_until_complete(fn(*varargs, **kwargs))
+ try:
+ loop = asyncio.get_running_loop()
+ except RuntimeError:
+ # No event loop running, create a new one
+ component = asyncio.run(fn(*varargs, **kwargs))
+ else:
+ # Event loop is already running
+ component = loop.run_until_complete(fn(*varargs, **kwargs))
else:
component = fn(*varargs, **kwargs)
Index: fire-0.7.1/fire/inspectutils.py
===================================================================
--- fire-0.7.1.orig/fire/inspectutils.py
+++ fire-0.7.1/fire/inspectutils.py
@@ -14,7 +14,6 @@
"""Inspection utility functions for Python Fire."""
-import asyncio
import inspect
import sys
import types
@@ -345,6 +344,6 @@ def GetClassAttrsDict(component):
def IsCoroutineFunction(fn):
try:
- return asyncio.iscoroutinefunction(fn)
+ return inspect.iscoroutinefunction(fn)
except: # pylint: disable=bare-except
return False