2014-01-19 17:10:39 +01:00
|
|
|
#
|
|
|
|
# spec file for package python-jmespath
|
|
|
|
#
|
2015-04-27 08:34:23 +02:00
|
|
|
# Copyright (c) 2015 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
|
|
|
|
2014-01-19 17:10:39 +01:00
|
|
|
%define baseName jmespath
|
|
|
|
|
2014-10-24 01:57:02 +02:00
|
|
|
Name: python-jmespath
|
2015-05-27 19:10:32 +02:00
|
|
|
Version: 0.7.1
|
2014-10-24 01:57:02 +02:00
|
|
|
Release: 0
|
|
|
|
Summary: Extract elements from JSON document
|
|
|
|
License: MIT
|
|
|
|
Group: Development/Languages/Python
|
|
|
|
Url: https://github.com/boto/jmespath
|
2015-04-27 08:34:23 +02:00
|
|
|
Source0: https://pypi.python.org/packages/source/j/%{baseName}/%{baseName}-%{version}.tar.gz
|
2014-10-24 01:57:02 +02:00
|
|
|
Requires: python
|
|
|
|
Requires: python-ply >= 3.4
|
|
|
|
BuildRequires: python
|
|
|
|
BuildRequires: python-devel
|
|
|
|
BuildRequires: python-ply
|
|
|
|
BuildRequires: python-setuptools
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
2014-01-19 17:10:39 +01:00
|
|
|
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
|
|
|
|
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
|
|
|
|
%else
|
|
|
|
BuildArch: noarch
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%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
|
|
|
|
%setup -q -n %{baseName}-%{version}
|
|
|
|
|
|
|
|
%build
|
|
|
|
python setup.py build
|
|
|
|
|
|
|
|
%install
|
|
|
|
python setup.py install --prefix=%{_prefix} --root=%{buildroot} --install-scripts=%{_bindir}
|
2015-05-27 19:10:32 +02:00
|
|
|
pushd %{buildroot}/%{_bindir}
|
|
|
|
ln -s jp.py jp
|
|
|
|
popd
|
2014-01-19 17:10:39 +01:00
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr(-,root,root,-)
|
|
|
|
%doc LICENSE.txt README.rst
|
|
|
|
%dir %{python_sitelib}/jmespath
|
|
|
|
%dir %{python_sitelib}/%{baseName}-%{version}-py%{py_ver}.egg-info
|
|
|
|
%{_bindir}/jp
|
2015-05-27 19:10:32 +02:00
|
|
|
%{_bindir}/jp.py
|
2014-01-19 17:10:39 +01:00
|
|
|
%{python_sitelib}/jmespath/*
|
|
|
|
%{python_sitelib}/*egg-info/*
|
|
|
|
|
|
|
|
%changelog
|