Blame python-PyLEMS.spec

1ce0b26
%global srcname PyLEMS
1ce0b26
%global libname pylems
1ce0b26
%global commit a96812a2a979a0bb4c503c6459d14e7d3602ea7c
1ce0b26
%global shortcommit %(c=%{commit}; echo ${c:0:7})
1ce0b26
1ce0b26
# https://fedoraproject.org/wiki/Packaging:DistTag?rd=Packaging/DistTag#Conditionals
1ce0b26
%if 0%{?fedora} < 30
1ce0b26
%global with_py2 1
1ce0b26
%else
1ce0b26
%global with_py2 0
1ce0b26
%endif
1ce0b26
1ce0b26
# Most tests try to download files from other github repos, so we cannot use them
1ce0b26
%global run_tests 0
1ce0b26
1ce0b26
%global _description \
1ce0b26
A LEMS (http://lems.github.io/LEMS) simulator written in Python which can be \
1ce0b26
used to run NeuroML2 (http://neuroml.org/neuroml2.php) models.
1ce0b26
1ce0b26
1ce0b26
Name:           python-%{srcname}
1ce0b26
Version:        0.4.9.1
1ce0b26
Release:        1%{?dist}
1ce0b26
Summary:        LEMS interpreter implemented in Python
1ce0b26
1ce0b26
License:        LGPLv3
1ce0b26
1ce0b26
# Use github source. Pypi source does not include license and examples.
1ce0b26
URL:            https://github.com/LEMS/%{libname}/
1ce0b26
Source0:        https://github.com/LEMS/%{libname}/archive/%{commit}/%{libname}-%{shortcommit}.tar.gz
1ce0b26
1ce0b26
BuildArch:      noarch
1ce0b26
1ce0b26
%description
1ce0b26
%{_description}
1ce0b26
1ce0b26
%package -n python3-%{srcname}
1ce0b26
Summary:        %{summary}
1ce0b26
BuildRequires:  python3-devel
1ce0b26
BuildRequires:  %{py3_dist lxml}
1ce0b26
Requires:  %{py3_dist lxml}
1ce0b26
Requires:  %{py3_dist matplotlib}
1ce0b26
Requires:  %{py3_dist numpy}
1ce0b26
%if %{run_tests}
1ce0b26
BuildRequires:  %{py3_dist nose}
1ce0b26
%endif
1ce0b26
%{?python_provide:%python_provide python3-%{srcname}}
1ce0b26
1ce0b26
%description -n python3-%{srcname}
1ce0b26
%{_description}
1ce0b26
1ce0b26
%package doc
1ce0b26
Summary: %{summary}
1ce0b26
1ce0b26
%description doc
1ce0b26
%{_description}
1ce0b26
1ce0b26
1ce0b26
%if %{with_py2}
1ce0b26
%package -n python2-%{srcname}
1ce0b26
Summary:        %{summary}
1ce0b26
BuildRequires:  python2-devel
1ce0b26
BuildRequires:  %{py2_dist lxml}
1ce0b26
Requires:  %{py2_dist lxml}
1ce0b26
Requires:  %{py2_dist matplotlib}
1ce0b26
Requires:  %{py2_dist numpy}
1ce0b26
%if %{run_tests}
1ce0b26
BuildRequires:  %{py2_dist nose}
1ce0b26
%endif
1ce0b26
%{?python_provide:%python_provide python2-%{srcname}}
1ce0b26
1ce0b26
%description -n python2-%{srcname}
1ce0b26
%{_description}
1ce0b26
%endif
1ce0b26
1ce0b26
%prep
1ce0b26
%autosetup -n %{libname}-%{commit}
1ce0b26
1ce0b26
# remove shebang
1ce0b26
sed -i '1d' lems/dlems/exportdlems.py
1ce0b26
1ce0b26
%build
1ce0b26
%py3_build
1ce0b26
1ce0b26
%if %{with_py2}
1ce0b26
%py2_build
1ce0b26
%endif
1ce0b26
1ce0b26
%install
1ce0b26
%py3_install
1ce0b26
1ce0b26
%if %{with_py2}
1ce0b26
%py2_install
1ce0b26
%endif
1ce0b26
1ce0b26
%check
1ce0b26
1ce0b26
%if %{run_tests}
1ce0b26
# From test*sh scripts in the source and .travis.yml
1ce0b26
1ce0b26
nosetests-3
1ce0b26
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} examples/apitest.py
1ce0b26
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} examples/apitest2.py
1ce0b26
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} examples/loadtest.py
1ce0b26
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} lems/dlems/exportdlems.py
1ce0b26
1ce0b26
%if %{with_py2}
1ce0b26
nosetests-2
1ce0b26
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} examples/apitest.py
1ce0b26
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} examples/apitest2.py
1ce0b26
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} examples/loadtest.py
1ce0b26
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} lems/dlems/exportdlems.py
1ce0b26
%endif
1ce0b26
%endif
1ce0b26
1ce0b26
%files -n python3-%{srcname}
1ce0b26
%license LICENSE.lesser
1ce0b26
%doc README.md
1ce0b26
%{python3_sitelib}/%{srcname}-%{version}-py3.?.egg-info
1ce0b26
%{python3_sitelib}/lems
1ce0b26
%{_bindir}/%{libname}
1ce0b26
1ce0b26
%files doc
1ce0b26
%license LICENSE.lesser
1ce0b26
%doc README.md examples
1ce0b26
1ce0b26
%if %{with_py2}
1ce0b26
%files -n python2-%{srcname}
1ce0b26
%license LICENSE.lesser
1ce0b26
%doc README.md
1ce0b26
%{python2_sitelib}/%{srcname}-%{version}-py2.?.egg-info
1ce0b26
%{python2_sitelib}/lems
1ce0b26
%{_bindir}/%{libname}
1ce0b26
%endif
1ce0b26
1ce0b26
%changelog
1ce0b26
* Sat Oct 27 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.4.9.1-1
1ce0b26
- Initial build