File python-voc.spec of Package python-voc

#
# spec file for package python-voc
#
# Copyright (c) 2019 SUSE LLC
#
# 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 https://bugs.opensuse.org/


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name:           python-voc
Version:        0.1.6
Release:        0
License:        BSD-3-Clause
Summary:        Convert Python code into Java bytecode
Url:            https://github.com/beeware/voc
Group:          Development/Languages/Python
Source:         https://files.pythonhosted.org/packages/source/v/voc/voc-%{version}.tar.gz
BuildRequires:  ant
BuildRequires:  java > 7
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
Recommends:     java > 7
BuildArch:      noarch

Requires(post):   update-alternatives
Requires(postun):   update-alternatives
%python_subpackages

%description
Tools to convert Python code into Java bytecode.

%prep
%setup -q -n voc-%{version}
rm tests/microbenchmarks.py
# Compilation fails due to class name `python` in file Platform.java
# Already renamed upstream
mv python/common/python/Platform.java python/common/python/platform.java

%build
%python_build

%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/voc
%{python_expand rm -r %{buildroot}%{$python_sitelib}/tests
%fdupes %{buildroot}%{$python_sitelib}
}

%if %{python3_version_nodots} < 37
# Lots of trivial test failures on Python 3.7+
# https://github.com/beeware/voc/issues/985
%check
export LANG=en_US.UTF8
%{python_expand sed -i 's/executable="[^"]*"/executable="$python"/' *.xml
#$python setup.py test
$python -m pytest
}
%endif

%post
%python_install_alternative voc

%postun
%python_uninstall_alternative voc

%files %{python_files}
%doc AUTHORS README.rst
%license LICENSE
%python_alternative %{_bindir}/vod
%python_alternative %{_bindir}/voc
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by