From dc2d0bad8ace7810214b92b1d0acc19abb46a3cb83f3c35d1e4a527bb37aef92 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 3 Mar 2025 03:23:11 +0000 Subject: [PATCH] - Update to 1.3.0: * add support for Python versions up through 3.12 * remove support for old Python versions older than 3.7 since test dependencies no longer support them * remove Python 2.7 support + remove tests & test commands only relevant to Python 2.7 + remove backwards-compatibility from code * enable running as a module (python -m genson) * modernize package configuration * Use a valid schema_uri in tests - Add patch use-sys-executable.patch: * Use sys.executable, rather than python in testsuite. - Switch to autosetup, pyproject and pytest macros. - No more greedy globs in %files. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-genson?expand=0&rev=5 --- cp1252.json | 1 - genson-1.2.2.tar.gz | 3 --- genson-1.3.0.tar.gz | 3 +++ python-genson.changes | 18 ++++++++++++++++++ python-genson.spec | 38 +++++++++++++++----------------------- use-sys-executable.patch | 33 +++++++++++++++++++++++++++++++++ utf-8.json | 1 - 7 files changed, 69 insertions(+), 28 deletions(-) delete mode 100644 cp1252.json delete mode 100644 genson-1.2.2.tar.gz create mode 100644 genson-1.3.0.tar.gz create mode 100644 use-sys-executable.patch delete mode 100644 utf-8.json diff --git a/cp1252.json b/cp1252.json deleted file mode 100644 index ce3afeb..0000000 --- a/cp1252.json +++ /dev/null @@ -1 +0,0 @@ -"€…™" \ No newline at end of file diff --git a/genson-1.2.2.tar.gz b/genson-1.2.2.tar.gz deleted file mode 100644 index 096e58e..0000000 --- a/genson-1.2.2.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8caf69aa10af7aee0e1a1351d1d06801f4696e005f06cedef438635384346a16 -size 34387 diff --git a/genson-1.3.0.tar.gz b/genson-1.3.0.tar.gz new file mode 100644 index 0000000..09a4ca8 --- /dev/null +++ b/genson-1.3.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e02db9ac2e3fd29e65b5286f7135762e2cd8a986537c075b06fc5f1517308e37 +size 34919 diff --git a/python-genson.changes b/python-genson.changes index 4142e03..bbe135a 100644 --- a/python-genson.changes +++ b/python-genson.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Mon Mar 3 03:20:38 UTC 2025 - Steve Kowalik + +- Update to 1.3.0: + * add support for Python versions up through 3.12 + * remove support for old Python versions older than 3.7 since test + dependencies no longer support them + * remove Python 2.7 support + + remove tests & test commands only relevant to Python 2.7 + + remove backwards-compatibility from code + * enable running as a module (python -m genson) + * modernize package configuration + * Use a valid schema_uri in tests +- Add patch use-sys-executable.patch: + * Use sys.executable, rather than python in testsuite. +- Switch to autosetup, pyproject and pytest macros. +- No more greedy globs in %files. + ------------------------------------------------------------------- Sun Jan 24 10:41:39 UTC 2021 - Jan Engelhardt diff --git a/python-genson.spec b/python-genson.spec index 335c5d4..1ab7b54 100644 --- a/python-genson.spec +++ b/python-genson.spec @@ -1,7 +1,7 @@ # # spec file for package python-genson # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,25 +16,27 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-genson -Version: 1.2.2 +Version: 1.3.0 Release: 0 Summary: Python JSON Schema generator License: MIT -Group: Development/Languages/Python URL: https://github.com/wolverdude/genson/ Source: https://files.pythonhosted.org/packages/source/g/genson/genson-%{version}.tar.gz -# https://github.com/wolverdude/GenSON/pull/53 -Source1: https://raw.githubusercontent.com/wolverdude/GenSON/master/test/fixtures/cp1252.json -Source2: https://raw.githubusercontent.com/wolverdude/GenSON/master/test/fixtures/utf-8.json +# PATCH-FIX-UPSTREAM gh#wolverdude/GenSON#84 +Patch0: use-sys-executable.patch +BuildRequires: %{python_module base >= 3.7} +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module jsonschema} +BuildRequires: %{python_module pytest} # /SECTION +Requires(post): update-alternatives +Requires(postun): update-alternatives %python_subpackages %description @@ -44,29 +46,18 @@ Besides taking JSON objects and generating schemas that describe them, this generator is able to merge schemas as well. %prep -%setup -q -n genson-%{version} -mkdir test/fixtures -cp %{SOURCE1} %{SOURCE2} test/fixtures/ -touch test/__init__.py +%autosetup -p1 -n genson-%{version} %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/genson %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -export LANG=en_US.UTF-8 -mkdir ~/bin -export PATH=~/bin:$PATH -%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib} -cp %{buildroot}/%{_bindir}/genson-%{$python_bin_suffix} ~/bin/genson -rm -f ~/bin/python -ln -s $(which $python) ~/bin/python -$python -m unittest -v -} +%pytest -k 'not test_no_input' %post %python_install_alternative genson @@ -78,6 +69,7 @@ $python -m unittest -v %doc AUTHORS.rst README.rst HISTORY.rst %license LICENSE %python_alternative %{_bindir}/genson -%{python_sitelib}/* +%{python_sitelib}/genson +%{python_sitelib}/genson-%{version}.dist-info %changelog diff --git a/use-sys-executable.patch b/use-sys-executable.patch new file mode 100644 index 0000000..8309c32 --- /dev/null +++ b/use-sys-executable.patch @@ -0,0 +1,33 @@ +From bfa7b22533082c954dcaed46bd7ff0bb3f2e291e Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +Date: Mon, 3 Mar 2025 14:14:04 +1100 +Subject: [PATCH] test: Use sys.executable for integration testing + +Systems may not have a python executable in $PATH when running the +testsuite. Since we're already running inside a Python process, we can +leverage sys.executable to give us the full path instead. +--- + test/test_bin.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/test/test_bin.py b/test/test_bin.py +index 5a8aeaf..08baff4 100644 +--- a/test/test_bin.py ++++ b/test/test_bin.py +@@ -1,6 +1,7 @@ + import unittest + import json + import os ++import sys + from subprocess import Popen, PIPE + from genson import SchemaBuilder + +@@ -25,7 +26,7 @@ def run(args=tuple(), stdin_data=None): + Run the ``genson`` executable as a subprocess and return + (stdout, stderr). + """ +- full_args = ['python', '-m', 'genson'] ++ full_args = [sys.executable, '-m', 'genson'] + full_args.extend(args) + env = os.environ.copy() + env['COLUMNS'] = '80' # set width for deterministic text wrapping diff --git a/utf-8.json b/utf-8.json deleted file mode 100644 index 738849b..0000000 --- a/utf-8.json +++ /dev/null @@ -1 +0,0 @@ -"€…™" \ No newline at end of file