18
0
Files
python-jmespath/python-jmespath.spec
Robert Schweikert 9c43305b92 - Update to 1.1.0
* Fix concurrency issue with cache
  * Added support for Python 3.12-3.14
  * Removed support for Python 3.7-3.8
- Rename LICENSE.txt to LICENSE in %license section

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-jmespath?expand=0&rev=60
2026-03-09 11:13:14 +00:00

118 lines
3.3 KiB
RPMSpec

#
# spec file for package python-jmespath
#
# Copyright (c) 2026 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%{?sle15_python_module_pythons}
Name: python-jmespath
Version: 1.1.0
Release: 0
Summary: Python module for declarative JSON document element extraction
License: MIT
URL: https://github.com/jmespath/jmespath.py
Source: https://github.com/jmespath/jmespath.py/archive/refs/tags/%{version}.tar.gz#/jmespath-%{version}.tar.gz
# Testing
BuildRequires: %{python_module hypothesis}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module ply >= 3.4}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-ply >= 3.4
%if %{with libalternatives}
Requires: alts
BuildRequires: alts
%else
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif
BuildArch: noarch
%python_subpackages
%description
JMESPath (pronounced "jaymz path") allows you to declaratively specify how
to extract elements from a JSON document.
For example, given this document:
{"foo": {"bar": "baz"}}
The jmespath expression foo.bar will return "baz".
JMESPath also supports:
Referencing elements in a list. Given the data:
{"foo": {"bar": ["one", "two"]}}
The expression: foo.bar[0] will return "one". You can also reference all
the items in a list using the * syntax:
{"foo": {"bar": [{"name": "one"}, {"name": "two"}]}}
The expression: foo.bar[*].name will return ["one", "two"]. Negative
indexing is also supported (-1 refers to the last element in the list).
Given the data above, the expression foo.bar[-1].name will return ["two"].
The * can also be used for hash types:
{"foo": {"bar": {"name": "one"}, "baz": {"name": "two"}}}
The expression: foo.*.name will return ["one", "two"].
%prep
%autosetup -p1 -n jmespath.py-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
mv %{buildroot}%{_bindir}/jp.py %{buildroot}%{_bindir}/jp
%python_clone -a %{buildroot}%{_bindir}/jp
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# hangs on python 3.8 with pytest
%pyunittest discover -v
%pre
# If libalternatives is used: Removing old update-alternatives entries.
%python_libalternatives_reset_alternative jp
%post
%python_install_alternative jp
%postun
%python_uninstall_alternative jp
%files %{python_files}
%license LICENSE
%doc README.rst
%{python_sitelib}/jmespath
%{python_sitelib}/jmespath-%{version}.dist-info
%python_alternative %{_bindir}/jp
%changelog