File python-sfepy.spec of Package python-sfepy

#
# spec file for package python-sfepy
#
# Copyright (c) 2017 SUSE LINUX Products 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/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-sfepy
Version:        2017.2
Release:        0
Summary:        Simple finite elements in Python
License:        BSD-2-Clause
Group:          Development/Languages/Python
Url:            http://sfepy.org/
Source0:        http://sfepy.org/doc-devel/_static/downloads.php?fun=download&ver=sfepy-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  fdupes
BuildRequires:  hdf5-devel
BuildRequires:  latex2html
BuildRequires:  %{python_module Cython}
BuildRequires:  %{python_module Pygments}
BuildRequires:  %{python_module Sphinx}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module matplotlib}
BuildRequires:  %{python_module numpy-devel}
BuildRequires:  %{python_module numpydoc}
BuildRequires:  %{python_module pyparsing}
BuildRequires:  %{python_module scipy}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module sympy}
BuildRequires:  %{python_module tables}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
BuildRequires:  swig
Requires:       python-pyparsing
Requires:       python-scipy
Recommends:     gmsh
Recommends:     python-matplotlib 
Recommends:     python-Mayavi2
Recommends:     python-pysparse
Recommends:     python-pexpect
Recommends:     tetgen

%python_subpackages

%description
Sfepy is a finite element analysis software based primarily on NumPy and SciPy.

%package -n %{name}-doc
Summary:        This package contains the HTML documentation for %{name}
Group:          Documentation/HTML
Provides:       %{python_module sfepy-doc = %{version}}
BuildArch:      noarch

%description -n %{name}-doc
Sfepy is a finite element analysis software based primarily on NumPy and SciPy.

This package contains the HTML documentation for %{name}.

%prep
%setup -q -n sfepy-%{version}

%build
export CFLAGS="%{optflags}"
%python_build
python3 setup.py htmldocs
rm -f doc/_build/html/.buildinfo
%fdupes doc/_build/html

%install
%python_install

# remove unwanted files
rm -rf %{buildroot}%{_datadir}/sfepy/doc
rm -rf %{buildroot}%{_datadir}/sfepy/examples

# find duplicates
%{python_expand %fdupes %{buildroot}%{$python_sitearch}
find %{buildroot}%{$python_sitearch}/sfepy/ -name "*.py" -exec sed -i "s|^#!/usr/bin/env python$|#!%__$python|" {} \; -exec grep -q "^#!%__$python$" {} \; -exec chmod a+x {} \;
$python -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}/sfepy/
$python -O -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}/sfepy/
%fdupes %{buildroot}%{$python_sitearch}
$python -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}/sfepy/base/
$python -O -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}/sfepy/base/
%fdupes %{buildroot}%{$python_sitearch}/sfepy/base/
$python -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}/linalg/extmods/
$python -O -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}/linalg/extmods/
%fdupes %{buildroot}%{$python_sitearch}/linalg/extmods/
}

find examples -name "*.py" -exec sed -i "s|^#!/usr/bin/env python$|#!%__python3|" {} \;
%fdupes examples

%files %{python_files}
%defattr(-,root,root,-)
%doc AUTHORS LICENSE README.rst
%python3_only %{_bindir}/*
%{python_sitearch}/*

%files -n %{name}-doc
%defattr(-,root,root,-)
%doc examples/
%doc doc/_build/html

%changelog
openSUSE Build Service is sponsored by