File python-canonicaljson.spec of Package python-canonicaljson

# 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

# Define just "test" as a package in _multibuild file to distinguish test
# instructions here
%if "@BUILD_FLAVOR@" == ""
%define _test 0
%define name_ext %nil
%define _test 1
%define name_ext -test

%{?!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:  {github_user}/%{pkg_name}
BuildRequires:  python-rpm-macros
%if 0%{?_test}
BuildRequires:  python-%{short_name}
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
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%if 0%{?_test}

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.

%if 0%{?_test}
# workaround to prevent post/install failing assuming this file for whatever
# reason
touch %{_sourcedir}/%{short_name}
%setup -q -n %{pkg_name}-%{version}

%if 0%{?_test}
python -c "import %{short_name}"

%if 0%{?_test}
# disable debug packages in package test to prevent error about missing files
%define debug_package %{nil}
%fdupes %{buildroot}%{_prefix}

%files %{python_files}


openSUSE Build Service is sponsored by