Add patches for python 3.13 compatibility

This commit is contained in:
Jerry James 2024-06-18 09:03:01 -06:00
commit d9f5cfb43d
3 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,30 @@
Fixes this error:
_____________ ERROR at setup of test_cm_config_log_only_if_changed _____________
tmp_path = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_cm_config_log_only_if_cha0')
@pytest.fixture()
def cwd_tmp_path(tmp_path):
# Run the whole test from inside tmp_path
> with tmp_path.cwd():
E TypeError: 'PosixPath' object does not support the context manager protocol
/builddir/build/BUILD/python-jupytext-1.16.2-build/jupytext-1.16.2/tests/conftest.py:50: TypeError
--- jupytext-1.16.2/tests/conftest.py.orig 2024-05-05 16:34:48.000000000 -0600
+++ jupytext-1.16.2/tests/conftest.py 2024-06-18 08:13:53.192133400 -0600
@@ -1,3 +1,4 @@
+import contextlib
import itertools
import os.path
import re
@@ -47,7 +48,7 @@ def cwd_tmpdir(tmpdir):
@pytest.fixture()
def cwd_tmp_path(tmp_path):
# Run the whole test from inside tmp_path
- with tmp_path.cwd():
+ with contextlib.chdir(tmp_path):
yield tmp_path

View file

@ -0,0 +1,16 @@
Fixes this warning:
/builddir/build/BUILD/python-jupytext-1.16.2-build/BUILDROOT/usr/lib/python3.13/site-packages/jupytext/cell_metadata.py:260: DeprecationWarning: 'maxsplit' is passed as positional argument
options = re.split(r"\s|,", options, 1)
--- jupytext-1.16.2/src/jupytext/cell_metadata.py.orig 2024-05-05 16:34:48.000000000 -0600
+++ jupytext-1.16.2/src/jupytext/cell_metadata.py 2024-06-18 08:15:50.518408511 -0600
@@ -257,7 +257,7 @@ def parse_rmd_options(line):
def rmd_options_to_metadata(options, use_runtools=False):
"""Parse rmd options and return a metadata dictionary"""
- options = re.split(r"\s|,", options, 1)
+ options = re.split(r"\s|,", options, maxsplit=1)
# Special case Wolfram Language, which sadly has a space in the language
# name.
if options[0:2] == ["wolfram", "language"]:

View file

@ -15,6 +15,12 @@ Source0: %{vcs}/archive/v%{version}/jupytext-%{version}.tar.gz
Source1: jupytext-%{version}-vendor.tar.xz
Source2: jupytext-%{version}-vendor-licenses.txt
Source3: prepare_vendor.sh
# Adapt to python 3.13 change in PosixPath.cwd
# See https://github.com/mwouts/jupytext/issues/1242
Patch0: %{name}-chdir.patch
# Fix a DeprecationWarning with passing maxsplit as a positional argument
# See https://github.com/mwouts/jupytext/pull/1241
Patch1: %{name}-maxsplit.patch
# s390x builds fail due to a bug in jupyterlab
# https://bugzilla.redhat.com/show_bug.cgi?id=2278011