14
0
Files
python-canonicaljson/python-canonicaljson.spec

106 lines
3.0 KiB
RPMSpec
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#
# spec file for package python
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#
# Define just "test" as a package in _multibuild file to distinguish test
# instructions here
%if "@BUILD_FLAVOR@" == ""
%define _test 0
%define name_ext %nil
%else
%define _test 1
%define name_ext -test
%endif
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define github_user matrix-org
%define short_name canonicaljson
%define pkg_name python-%{short_name}
Name: %{pkg_name}%{?name_ext}
Version: 1.1.3
Release: 0
Summary: Canonical JSON for Python
License: Apache-2.0
Group: Development/Languages/Python
Url: https://github.com/%{github_user}/%{pkg_name}
Source: https://github.com/%{github_user}/%{pkg_name}/archive/v%{version}/%{pkg_name}-%{version}.tar.gz
BuildRequires: python-rpm-macros
%if 0%{?_test}
BuildRequires: python-%{short_name}
%else
BuildRequires: %{python_module base}
BuildRequires: %{python_module frozendict}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module simplejson}
BuildRequires: fdupes
Requires: python-frozendict
Requires: python-simplejson
Requires: python-six
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%if 0%{?_test}
%else
%python_subpackages
%endif
%description
This is a Python module which encodes objects and arrays into JSON as per
RFC 7159.
* Sorts object keys so that it yields the same result each time.
* Has no insignificant whitespace to make the output as small as possible.
* Escapes only the characters that must be escaped, U+0000 to U+0019 /
U+0022 / U+0056, to keep the output as small as possible.
* Uses the shortest escape sequence for each escaped character.
* Encodes the JSON as UTF-8.
* Can encode frozendict immutable dictionaries.
%prep
%if 0%{?_test}
# workaround to prevent post/install failing assuming this file for whatever
# reason
touch %{_sourcedir}/%{short_name}
%else
%setup -q -n %{pkg_name}-%{version}
%endif
%build
%if 0%{?_test}
python -c "import %{short_name}"
%else
%python_build
%endif
%install
%if 0%{?_test}
# disable debug packages in package test to prevent error about missing files
%define debug_package %{nil}
%else
%python_install
%fdupes %{buildroot}%{_prefix}
%files %{python_files}
%defattr(-,root,root,-)
%doc README.rst LICENSE
%{python_sitelib}/*
%endif
%changelog