File python-pyxb.spec of Package python-pyxb
#
# spec file for package python-pyxb
#
# Copyright (c) 2021 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/
#
%define realnam PyXB
%{?!python_module:%define python_module() python3-%{**}}
%define oldpython python
Name: python-pyxb
Version: 1.2.6
Release: 0
Summary: Python class code generator based on XMLSchemas
License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/pabigot/pyxb
Source0: https://files.pythonhosted.org/packages/source/P/%{realnam}/%{realnam}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM eight-args-datetime.patch gh#pabigot/pyxb#123 mcepl@suse.com
# fix arguments for the time fields
Patch0: eight-args-datetime.patch
# PATCH-FIX-UPSTREAM deprecated-collection-use.patch gh#pabigot/pyxb#111 mcepl@suse.com
# Use collections.abc
Patch1: deprecated-collection-use.patch
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: %{python_module xml}
BuildArch: noarch
Requires: python-xml
Requires(post): update-alternatives
Requires(postun): update-alternatives
Obsoletes: %{oldpython}-pyxb < %{version}-%{release}
%python_subpackages
%description
PyXB is a pure Python package that generates Python code for classes that correspond to data structures defined by XMLSchema.
In concept it is similar to JAXB for Java and CodeSynthesis XSD for C++.
%prep
%autosetup -p1 -n %{realnam}-%{version}
%build
%python_build
%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/pyxbdump
%python_clone -a %{buildroot}%{_bindir}/pyxbgen
%python_clone -a %{buildroot}%{_bindir}/pyxbwsdl
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# It is hard to rewrite tests to the standard form
# also, gh#pabigot/pyxb#133
%python_exec setup.py test -v
%post
%python_install_alternative pyxbdump
%python_install_alternative pyxbgen
%python_install_alternative pyxbwsdl
%postun
%python_uninstall_alternative pyxbdump
%python_uninstall_alternative pyxbgen
%python_uninstall_alternative pyxbwsdl
%files %{python_files}
%license LICENSE
%doc NOTICE PKG-INFO README.txt
%{python_sitelib}/pyxb/
%{python_sitelib}/PyXB-%{version}-*.egg-info
%python_alternative %{_bindir}/pyxbdump
%python_alternative %{_bindir}/pyxbgen
%python_alternative %{_bindir}/pyxbwsdl
%changelog