2014-01-19 17:10:39 +01:00
|
|
|
#
|
|
|
|
# spec file for package python-jmespath
|
|
|
|
#
|
2018-08-13 13:23:10 +02:00
|
|
|
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
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.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
2014-10-24 01:57:02 +02:00
|
|
|
|
2017-03-25 17:39:38 +01:00
|
|
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
2014-10-24 01:57:02 +02:00
|
|
|
Name: python-jmespath
|
2017-11-10 00:10:16 +01:00
|
|
|
Version: 0.9.3
|
2014-10-24 01:57:02 +02:00
|
|
|
Release: 0
|
|
|
|
Summary: Extract elements from JSON document
|
|
|
|
License: MIT
|
|
|
|
Group: Development/Languages/Python
|
2018-08-13 13:23:10 +02:00
|
|
|
URL: https://github.com/boto/jmespath
|
|
|
|
Source: https://files.pythonhosted.org/packages/source/j/jmespath/jmespath-%{version}.tar.gz
|
2017-03-25 17:39:38 +01:00
|
|
|
BuildRequires: %{python_module devel}
|
2018-08-13 13:23:10 +02:00
|
|
|
# Testing
|
|
|
|
BuildRequires: %{python_module nose}
|
2017-03-25 17:39:38 +01:00
|
|
|
BuildRequires: %{python_module ply >= 3.4}
|
|
|
|
BuildRequires: %{python_module setuptools}
|
|
|
|
BuildRequires: %{python_module simplejson}
|
2018-08-13 13:23:10 +02:00
|
|
|
BuildRequires: fdupes
|
2017-03-25 17:39:38 +01:00
|
|
|
BuildRequires: python-rpm-macros
|
2016-01-20 20:43:20 +01:00
|
|
|
Requires: python-base
|
2014-10-24 01:57:02 +02:00
|
|
|
Requires: python-ply >= 3.4
|
2017-03-25 17:39:38 +01:00
|
|
|
Requires: python-simplejson
|
2018-08-13 13:23:10 +02:00
|
|
|
Requires(post): update-alternatives
|
2017-03-29 16:16:20 +02:00
|
|
|
Requires(postun): update-alternatives
|
2017-03-25 17:39:38 +01:00
|
|
|
%if 0%{?suse_version} > 1110
|
2014-01-19 17:10:39 +01:00
|
|
|
BuildArch: noarch
|
|
|
|
%endif
|
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
|
2017-03-25 17:39:38 +01:00
|
|
|
%setup -q -n jmespath-%{version}
|
2014-01-19 17:10:39 +01:00
|
|
|
|
|
|
|
%build
|
2017-03-25 17:39:38 +01:00
|
|
|
%python_build
|
2014-01-19 17:10:39 +01:00
|
|
|
|
|
|
|
%install
|
2017-03-25 17:39:38 +01:00
|
|
|
%python_install
|
|
|
|
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
|
2017-03-25 17:39:38 +01:00
|
|
|
%python_expand nosetests-%{$python_bin_suffix} tests
|
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
|
2017-03-25 17:39:38 +01:00
|
|
|
%{python_sitelib}/*
|
|
|
|
%python_alternative %{_bindir}/jp
|
2014-01-19 17:10:39 +01:00
|
|
|
|
|
|
|
%changelog
|