14
0

Accepting request 599792 from home:okurz:branches:devel:languages:python

Add missing runtime require; Add package self-test to prevent this in the future :)

OBS-URL: https://build.opensuse.org/request/show/599792
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-canonicaljson?expand=0&rev=6
This commit is contained in:
2018-04-22 20:22:30 +00:00
committed by Git OBS Bridge
parent eef83b39bc
commit 34098cfaa5
3 changed files with 56 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
#
# spec file for package python-canonicaljson
# spec file for package python
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
@@ -16,29 +16,48 @@
#
# 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
Name: python-%{short_name}
%define pkg_name python-%{short_name}
Name: %{pkg_name}%{?name_ext}
Version: 1.1.3
Release: 0
Summary: Canonical JSON
License: Apache-2.0
Group: Development/Languages/Python
Url: https://github.com/%{github_user}/%{name}
Source: https://github.com/%{github_user}/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
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
BuildRequires: python-rpm-macros
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
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
%{short_name}
@@ -55,12 +74,26 @@ Features
* Can encode frozendict immutable dictionaries.
%prep
%setup -q -n %{name}-%{version}
%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}
@@ -69,4 +102,6 @@ Features
%doc README.rst LICENSE
%{python_sitelib}/*
%endif
%changelog