9c2071b
%global pypi_name admesh
9c2071b
%global with_python3 1
9c2071b
9c2071b
Name:           python-%{pypi_name}
cf170d3
Version:        0.98.3
9c2071b
Release:        1%{?dist}
9c2071b
Summary:        Python bindings for ADMesh, STL manipulation library
9c2071b
9c2071b
License:        GPLv2+
9c2071b
URL:            https://github.com/admesh/python-admesh
9c2071b
Source0:        https://pypi.python.org/packages/source/a/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
9c2071b
 
9c2071b
BuildRequires:  python2-devel
9c2071b
BuildRequires:  python-setuptools
8947dcb
BuildRequires:  pytest
9c2071b
BuildRequires:  Cython
9c2071b
BuildRequires:  admesh-devel >= 0.98
9c2071b
 
9c2071b
%if %{?with_python3}
9c2071b
BuildRequires:  python3-devel
8947dcb
BuildRequires:  python3-pytest
9c2071b
BuildRequires:  python3-setuptools
9c2071b
BuildRequires:  python3-Cython
9c2071b
%endif # if with_python3
9c2071b
9c2071b
9c2071b
%description
9c2071b
This module provides bindings for the ADMesh library.
9c2071b
It lets you manipulate 3D models in binary or ASCII STL
9c2071b
format and partially repair them if necessary.
9c2071b
9c2071b
9c2071b
%if 0%{?with_python3}
9c2071b
%package -n     python3-%{pypi_name}
9c2071b
Summary:        Python 3 bindings for ADMesh, STL maipulation library
9c2071b
9c2071b
9c2071b
%description -n python3-%{pypi_name}
9c2071b
This module provides bindings for the ADMesh library.
9c2071b
It lets you manipulate 3D models in binary or ASCII STL
9c2071b
format and partially repair them if necessary.
9c2071b
%endif # with_python3
9c2071b
9c2071b
9c2071b
%prep
9c2071b
%setup -q -n %{pypi_name}-%{version}
9c2071b
# Remove bundled egg-info
9c2071b
rm -rf %{pypi_name}.egg-info
9c2071b
9c2071b
9c2071b
%if 0%{?with_python3}
9c2071b
rm -rf %{py3dir}
9c2071b
cp -a . %{py3dir}
9c2071b
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
9c2071b
9c2071b
%endif # with_python3
9c2071b
9c2071b
9c2071b
%build
9c2071b
%{__python2} setup.py build
9c2071b
9c2071b
%if 0%{?with_python3}
9c2071b
pushd %{py3dir}
9c2071b
%{__python3} setup.py build
9c2071b
popd
9c2071b
%endif # with_python3
9c2071b
9c2071b
9c2071b
%install
9c2071b
%{__python2} setup.py install --skip-build --root %{buildroot}
9c2071b
9c2071b
%if 0%{?with_python3}
9c2071b
pushd %{py3dir}
9c2071b
%{__python3} setup.py install --skip-build --root %{buildroot}
9c2071b
popd
9c2071b
%endif # with_python3
9c2071b
9c2071b
%check
9c2071b
export PYTHONPATH=`echo build/lib.linux-*/`
9c2071b
py.test-%{python2_version} -v
9c2071b
9c2071b
%if 0%{?with_python3}
9c2071b
pushd %{py3dir}
9c2071b
export PYTHONPATH=`echo build/lib.linux-*/`
9c2071b
py.test-%{python3_version} -v
9c2071b
popd
9c2071b
%endif # with_python3
9c2071b
9c2071b
%files
9c2071b
%doc README.rst COPYING
9c2071b
%attr(0755,root,root) %{python2_sitearch}/%{pypi_name}.so
9c2071b
%{python2_sitearch}/%{pypi_name}-%{version}-py?.?.egg-info
9c2071b
9c2071b
%if 0%{?with_python3}
9c2071b
%files -n python3-%{pypi_name}
9c2071b
%doc README.rst COPYING
9c2071b
%attr(0755,root,root) %{python3_sitearch}/%{pypi_name}.cpython-??m.so
9c2071b
%{python3_sitearch}/%{pypi_name}-%{version}-py?.?.egg-info
9c2071b
%endif # with_python3
9c2071b
9c2071b
9c2071b
%changelog
cf170d3
* Wed Feb 25 2015 Miro Hrončok <mhroncok@redhat.com> - 0.98.3-1
cf170d3
- New version 0.98.3
cf170d3
9c2071b
* Wed Sep 03 2014 Miro Hrončok <mhroncok@redhat.com> - 0.98.1-1
9c2071b
- New version
8947dcb
- Run tests, add BR pytest
9c2071b
9c2071b
* Wed Sep 03 2014 Miro Hrončok <mhroncok@redhat.com> - 0.98-3
9c2071b
- Set correct executable permissions
9c2071b
- Typo in summary
9c2071b
9c2071b
* Thu Jul 31 2014 Miro Hrončok <mhroncok@redhat.com> - 0.98-2
9c2071b
- Require setuptools.
9c2071b
9c2071b
* Tue Jul 29 2014 Miro Hrončok <mhroncok@redhat.com> - 0.98-1
9c2071b
- Initial package.