Accepting request 1045367 from home:bnavigator:branches:devel:languages:python

- Create subpackages for [format] and [format-nongpl] extras
  * required by the tests for python-jupyter-server
- Test in _multibuild in order to check that the rpm requirements
  are set correctly

OBS-URL: https://build.opensuse.org/request/show/1045367
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-jsonschema?expand=0&rev=59
This commit is contained in:
Matej Cepl 2022-12-27 17:41:17 +00:00 committed by Git OBS Bridge
parent 1ecd20fd71
commit af583d06c5
3 changed files with 76 additions and 26 deletions

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Dec 26 11:13:34 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Create subpackages for [format] and [format-nongpl] extras
* required by the tests for python-jupyter-server
- Test in _multibuild in order to check that the rpm requirements
are set correctly
-------------------------------------------------------------------
Wed Nov 30 13:41:12 UTC 2022 - Johannes Kastl <kastl@b1-systems.de>

View File

@ -1,5 +1,5 @@
#
# spec file for package python-jsonschema
# spec file
#
# Copyright (c) 2022 SUSE LLC
#
@ -16,49 +16,42 @@
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
Name: python-jsonschema
Name: python-jsonschema%{psuffix}
Version: 4.17.3
Release: 0
Summary: An implementation of JSON-Schema validation for Python
License: MIT
URL: https://github.com/python-jsonschema/jsonschema
Source: https://files.pythonhosted.org/packages/source/j/jsonschema/jsonschema-%{version}.tar.gz
# SECTION build
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module hatch-fancy-pypi-readme}
BuildRequires: %{python_module hatch_vcs}
BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module pip}
# /SECTION
# SECTION runtime
BuildRequires: %{python_module attrs >= 17.4.0}
BuildRequires: %{python_module importlib-metadata if %python-base < 3.8}
BuildRequires: %{python_module importlib-resources >= 1.4.0 if %python-base < 3.9}
BuildRequires: %{python_module pkgutil-resolve-name if %python-base < 3.9}
BuildRequires: %{python_module pyrsistent >= 0.14.0}
BuildRequires: %{python_module typing-extensions if %python-base < 3.8}
# SECTION test
BuildRequires: %{python_module Twisted}
BuildRequires: git-core
# /SECTION
# SECTION extras (if available)
#BuildRequires: %%{python_module fqdn}
BuildRequires: %{python_module idna}
#BuildRequires: %%{python_module isoduration}
BuildRequires: %{python_module jsonpointer > 1.13}
#BuildRequires: %%{python_module rfc3339-validator}
BuildRequires: %{python_module rfc3987}
#BuildRequires: %%{python_module uri_template}
BuildRequires: %{python_module webcolors >= 1.11}
# /SECTION
BuildRequires: fdupes
BuildRequires: python-rpm-macros >= 20210929
%if %{with test}
BuildRequires: %{python_module Twisted}
BuildRequires: %{python_module jsonschema = %{version}}
BuildRequires: %{python_module jsonschema-format = %{version}}
BuildRequires: %{python_module jsonschema-format-nongpl = %{version}}
BuildRequires: git-core
%endif
Requires: python-attrs >= 17.4.0
Requires: python-pyrsistent >= 0.14.0
%if 0%{python_version_nodots} < 38
@ -85,9 +78,44 @@ The validator can be used as python module and from console:
$ jsonschema --instance sample.json sample.schema
%package format
Summary: An implementation of JSON-Schema validation for Python [format] extra
Requires: python-fqdn
Requires: python-idna
Requires: python-isoduration
Requires: python-jsonpointer > 1.13
Requires: python-jsonschema = %{version}
Requires: python-rfc3339-validator
Requires: python-rfc3987
Requires: python-uri_template
Requires: python-webcolors >= 1.11
%description format
jsonschema is an implementation of the JSON Schema specification for Python.
This subpackage provides the [format] extra
%package format-nongpl
Summary: An implementation of JSON-Schema validation for Python [format-nongpl] extra
Requires: python-fqdn
Requires: python-idna
Requires: python-isoduration
Requires: python-jsonpointer > 1.13
Requires: python-jsonschema = %{version}
Requires: python-rfc3339-validator
Requires: python-rfc3986-validator > 0.1.0
Requires: python-uri_template
Requires: python-webcolors >= 1.11
%description format-nongpl
jsonschema is an implementation of the JSON Schema specification for Python.
This subpackage provides the [format-nongpl] extra
%prep
%setup -q -n jsonschema-%{version}
%if !%{with test}
%build
%pyproject_wheel
@ -98,15 +126,18 @@ The validator can be used as python module and from console:
%fdupes %{buildroot}%{$python_sitelib}
}
# Prepare for update-alternatives usage
# Prepare for libalternatives/update-alternatives usage
%python_clone -a %{buildroot}%{_bindir}/jsonschema
%endif
%if %{with test}
%check
export JSON_SCHEMA_TEST_SUITE=$PWD/json
%{python_expand # see tox.ini
export PYTHONPATH=%{buildroot}%{$python_sitelib}
$python -B -m twisted.trial jsonschema
}
%endif
%pre
# If libalternatives is used: Removing old update-alternatives entries.
@ -118,6 +149,7 @@ $python -B -m twisted.trial jsonschema
%preun
%python_uninstall_alternative jsonschema
%if !%{with test}
%files %{python_files}
%license COPYING
%doc README.rst
@ -125,4 +157,11 @@ $python -B -m twisted.trial jsonschema
%{python_sitelib}/jsonschema
%{python_sitelib}/jsonschema-%{version}*-info
%files %{python_files format}
%license COPYING
%files %{python_files format-nongpl}
%license COPYING
%endif
%changelog