From 47509c59a243e16b9d9d0ad0a4196506e53c1dcaf77d98c91bca8cf1a31fd3d3 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Mon, 23 Jun 2025 05:46:32 +0000 Subject: [PATCH] Accepting request 1287206 from home:nkrapp:branches:devel:languages:python - Add support-python312.patch to not depend on distutils (boo#1245108) - clean up duplicate files OBS-URL: https://build.opensuse.org/request/show/1287206 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-editor?expand=0&rev=20 --- python-python-editor.changes | 6 ++++++ python-python-editor.spec | 10 ++++++---- support-python312.patch | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 support-python312.patch diff --git a/python-python-editor.changes b/python-python-editor.changes index e110698..52b231b 100644 --- a/python-python-editor.changes +++ b/python-python-editor.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jun 20 11:51:56 UTC 2025 - Nico Krapp + +- 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á diff --git a/python-python-editor.spec b/python-python-editor.spec index ce35a15..4e50dca 100644 --- a/python-python-editor.spec +++ b/python-python-editor.spec @@ -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 diff --git a/support-python312.patch b/support-python312.patch new file mode 100644 index 0000000..f69295b --- /dev/null +++ b/support-python312.patch @@ -0,0 +1,33 @@ +From 5023fafd265add111b29baca59b07f140daf75b7 Mon Sep 17 00:00:00 2001 +From: Branch Vincent +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: