2014-01-19 17:10:39 +01:00
|
|
|
#
|
|
|
|
# spec file for package python-jmespath
|
|
|
|
#
|
2024-02-01 15:09:43 +01:00
|
|
|
# Copyright (c) 2024 SUSE LLC
|
2014-01-19 17:10:39 +01:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2018-12-04 14:35:33 +01:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2014-01-19 17:10:39 +01:00
|
|
|
#
|
|
|
|
|
2014-10-24 01:57:02 +02:00
|
|
|
|
2023-09-19 09:31:23 +02:00
|
|
|
%{?sle15_python_module_pythons}
|
2014-10-24 01:57:02 +02:00
|
|
|
Name: python-jmespath
|
2023-01-06 14:08:21 +01:00
|
|
|
Version: 1.0.1
|
2014-10-24 01:57:02 +02:00
|
|
|
Release: 0
|
2018-08-17 13:44:41 +02:00
|
|
|
Summary: Python module for declarative JSON document element extraction
|
2014-10-24 01:57:02 +02:00
|
|
|
License: MIT
|
2019-04-04 23:02:37 +02:00
|
|
|
URL: https://github.com/jmespath/jmespath.py
|
2021-06-08 13:39:29 +02:00
|
|
|
Source: https://github.com/jmespath/jmespath.py/archive/refs/tags/%{version}.tar.gz#/jmespath-%{version}.tar.gz
|
2018-08-13 13:23:10 +02:00
|
|
|
# Testing
|
2019-04-04 23:02:37 +02:00
|
|
|
BuildRequires: %{python_module hypothesis}
|
2024-02-01 15:09:43 +01:00
|
|
|
BuildRequires: %{python_module pip}
|
2017-03-25 17:39:38 +01:00
|
|
|
BuildRequires: %{python_module ply >= 3.4}
|
2023-01-06 14:08:21 +01:00
|
|
|
BuildRequires: %{python_module pytest}
|
2017-03-25 17:39:38 +01:00
|
|
|
BuildRequires: %{python_module setuptools}
|
2024-02-01 15:09:43 +01:00
|
|
|
BuildRequires: %{python_module wheel}
|
2018-08-13 13:23:10 +02:00
|
|
|
BuildRequires: fdupes
|
2017-03-25 17:39:38 +01:00
|
|
|
BuildRequires: python-rpm-macros
|
2014-10-24 01:57:02 +02:00
|
|
|
Requires: python-ply >= 3.4
|
2018-08-13 13:23:10 +02:00
|
|
|
Requires(post): update-alternatives
|
2024-02-01 15:09:43 +01:00
|
|
|
Requires(postun): update-alternatives
|
2014-01-19 17:10:39 +01:00
|
|
|
BuildArch: noarch
|
2017-03-25 17:39:38 +01:00
|
|
|
%python_subpackages
|
|
|
|
|
2014-01-19 17:10:39 +01:00
|
|
|
%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
|
2023-01-06 14:08:21 +01:00
|
|
|
%autosetup -p1 -n jmespath.py-%{version}
|
2014-01-19 17:10:39 +01:00
|
|
|
|
|
|
|
%build
|
2024-02-01 15:09:43 +01:00
|
|
|
%pyproject_wheel
|
2014-01-19 17:10:39 +01:00
|
|
|
|
|
|
|
%install
|
2024-02-01 15:09:43 +01:00
|
|
|
%pyproject_install
|
2017-03-25 17:39:38 +01:00
|
|
|
mv %{buildroot}%{_bindir}/jp.py %{buildroot}%{_bindir}/jp
|
|
|
|
%python_clone -a %{buildroot}%{_bindir}/jp
|
2018-08-13 13:23:10 +02:00
|
|
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
2014-01-19 17:10:39 +01:00
|
|
|
|
2016-01-20 20:10:15 +01:00
|
|
|
%check
|
2023-01-06 14:08:21 +01:00
|
|
|
# hangs on python 3.8 with pytest
|
2021-06-08 13:39:29 +02:00
|
|
|
%pyunittest discover -v
|
2016-01-20 20:10:15 +01:00
|
|
|
|
|
|
|
%post
|
2017-03-25 17:39:38 +01:00
|
|
|
%python_install_alternative jp
|
2016-01-20 20:10:15 +01:00
|
|
|
|
2017-03-25 17:39:38 +01:00
|
|
|
%postun
|
|
|
|
%python_uninstall_alternative jp
|
2016-01-20 20:10:15 +01:00
|
|
|
|
2017-03-25 17:39:38 +01:00
|
|
|
%files %{python_files}
|
2018-08-13 13:23:10 +02:00
|
|
|
%license LICENSE.txt
|
|
|
|
%doc README.rst
|
2023-02-10 10:10:39 +01:00
|
|
|
%{python_sitelib}/jmespath
|
2024-02-01 15:09:43 +01:00
|
|
|
%{python_sitelib}/jmespath-%{version}.dist-info
|
2017-03-25 17:39:38 +01:00
|
|
|
%python_alternative %{_bindir}/jp
|
2014-01-19 17:10:39 +01:00
|
|
|
|
|
|
|
%changelog
|