49c78bc
# Require network, so run locally on mock with --enable-network
49c78bc
%bcond_with tests
1ce0b26
6d4589d
%global forgeurl https://github.com/LEMS/pylems/
6d4589d
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
89f9229
Name:           python-PyLEMS
5dd7e88
Version:        0.6.7
89f9229
Release:        %autorelease
1ce0b26
Summary:        LEMS interpreter implemented in Python
1ce0b26
6d4589d
%forgemeta
6d4589d
c51bfed
License:        LGPL-3.0-only
1ce0b26
1ce0b26
# Use github source. Pypi source does not include license and examples.
6d4589d
URL:            %{forgeurl}
6d4589d
Source0:        %{forgesource}
89f9229
# Generate man page for pylems
74b1508
# help2man -n "LEMS interpreter implemented in Python" --version-string="0.5.9" -N pylems -S "https://lems.github.io" -o pylems.1
89f9229
# Sent upstream: https://github.com/LEMS/pylems/pull/64
1ce0b26
1ce0b26
BuildArch:      noarch
1ce0b26
1ce0b26
%description
1ce0b26
%{_description}
1ce0b26
89f9229
%package -n python3-PyLEMS
1ce0b26
Summary:        %{summary}
1ce0b26
BuildRequires:  python3-devel
49c78bc
%if %{with tests}
89f9229
BuildRequires:  %{py3_dist pytest}
1ce0b26
%endif
1ce0b26
89f9229
%description -n python3-PyLEMS
1ce0b26
%{_description}
1ce0b26
1ce0b26
%package doc
1ce0b26
Summary: %{summary}
1ce0b26
1ce0b26
%description doc
1ce0b26
%{_description}
1ce0b26
1ce0b26
1ce0b26
%prep
6d4589d
%forgeautosetup
1ce0b26
1ce0b26
# remove shebang
1ce0b26
sed -i '1d' lems/dlems/exportdlems.py
1ce0b26
89f9229
%generate_buildrequires
92b47b7
%pyproject_buildrequires
89f9229
1ce0b26
%build
89f9229
%pyproject_wheel
1ce0b26
1ce0b26
%install
89f9229
%pyproject_install
0cbb59c
%pyproject_save_files -l lems
89f9229
92b47b7
install -p -m 0644 -D -t $RPM_BUILD_ROOT/%{_mandir}/man1/  man/man1/*.1
1ce0b26
1ce0b26
%check
49c78bc
%if %{with tests}
49c78bc
# A lot of the tests use files from other software repositories, so we can't use them.
89f9229
%{pytest}
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
%endif
1ce0b26
89f9229
%files -n python3-PyLEMS -f %{pyproject_files}
89f9229
%{_bindir}/pylems
74b1508
%{_mandir}/man1/pylems.1*
1ce0b26
1ce0b26
%files doc
1ce0b26
%license LICENSE.lesser
1ce0b26
%doc README.md examples
1ce0b26
1ce0b26
%changelog
89f9229
%autochangelog