14
0

Accepting request 1287805 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1287805
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-python-editor?expand=0&rev=8
This commit is contained in:
2025-06-23 13:05:21 +00:00
committed by Git OBS Bridge
3 changed files with 45 additions and 4 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jun 20 11:51:56 UTC 2025 - Nico Krapp <nico.krapp@suse.com>
- Add support-python312.patch to not depend on distutils (boo#1245108)
- clean up duplicate files
-------------------------------------------------------------------
Tue Jun 10 12:56:27 UTC 2025 - Markéta Machová <mmachova@suse.com>

View File

@@ -24,9 +24,12 @@ License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/fmoo/python-editor
Source: https://files.pythonhosted.org/packages/source/p/python-editor/python-editor-%{version}.tar.gz
# PATCH-FIX-UPSTREAM support-python312.patch https://github.com/fmoo/python-editor/commit/5023fafd265add111b29baca59b07f140daf75b7
Patch0: support-python312.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
%if 0%{?is_opensuse}
@@ -40,7 +43,7 @@ programmatically interfacing with the editor defined in the EDITOR
environment variable.
%prep
%setup -q -n python-editor-%{version}
%autosetup -p1 -n python-editor-%{version}
%build
find -type f -exec chmod 644 {} +
@@ -49,13 +52,12 @@ find -type f -exec chmod 644 {} +
%install
%pyproject_install
%python_expand sed -i -e '/^#!\/usr\/bin\/env/d' %{buildroot}%{$python_sitelib}/editor.py
%python_expand %fdupes %{buildroot}%{$python_sitelib}/
%if 0%{?is_opensuse}
# the example does not look like an unit test
# %check
# %%check
# export EDITOR='nano'
# Xpython_exec test.py
%endif
%files %{python_files}
%license LICENSE

33
support-python312.patch Normal file
View File

@@ -0,0 +1,33 @@
From 5023fafd265add111b29baca59b07f140daf75b7 Mon Sep 17 00:00:00 2001
From: Branch Vincent <branchevincent@gmail.com>
Date: Sun, 8 Oct 2023 12:52:53 -0700
Subject: [PATCH] support python 3.12
Python 3.12 has removed `distutils`: https://docs.python.org/3.12/whatsnew/3.12.html#removed
---
editor.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: python-editor-1.0.4/editor.py
===================================================================
--- python-editor-1.0.4.orig/editor.py
+++ python-editor-1.0.4/editor.py
@@ -8,7 +8,6 @@ import locale
import os.path
import subprocess
import tempfile
-from distutils.spawn import find_executable
__all__ = [
@@ -52,6 +51,10 @@ def get_editor_args(editor):
def get_editor():
+ try:
+ from distutils.spawn import find_executable
+ except ImportError:
+ from shutil import which as find_executable
# Get the editor from the environment. Prefer VISUAL to EDITOR
editor = os.environ.get('VISUAL') or os.environ.get('EDITOR')
if editor: