File f90nml.spec of Package f90nml
#
# spec file for package f90nml
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# 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/
#
Name: f90nml
Version: 1.5
Release: 0
Summary: A Fortran namelist parser, generator, and editor
License: Apache-2.0
Group: Development/Libraries/Python
URL: https://github.com/marshallward/f90nml
Source: https://github.com/marshallward/f90nml/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: python-rpm-macros
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%if 0%{?suse_version}
BuildRequires: python3-Sphinx
BuildRequires: fdupes
%else
BuildRequires: python3-sphinx
%endif
Requires: python3
BuildArch: noarch
%description
A Python module and command line tool that provides a simple
interface for the reading, writing, and modifying Fortran namelist files.
A namelist file is parsed and converted into an Namelist object, which
behaves like a standard Python dict. Values are converted from Fortran
data types to equivalent primitive Python types.
The command line tool f90nml can be used to modify individual values inside
of a shell environment. It can also be used to convert the data between
namelists and other configuration formats. JSON and YAML formats are currently
supported.
%prep
%autosetup
%build
python3 setup.py build
pushd docs
make man
popd
%check
sed -i 's/\<python\>/python3/g' Makefile
make test
%install
python3 setup.py install --root=%{buildroot} --prefix=%{_prefix} --optimize=1
rm -r %{buildroot}%{python3_sitelib}/tests/
install -m 0644 -D docs/build/man/%{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
gzip -9 %{buildroot}%{_mandir}/man1/%{name}.1
%if 0%{?suse_version}
%{python3_fix_shebang}
%fdupes %{buildroot}%{python3_sitelib}
%endif
%files
%license LICENSE
%doc README.rst CHANGELOG
%{_bindir}/%{name}
%dir %{python3_sitelib}/%{name}
%{python3_sitelib}/%{name}/*.py
%dir %{python3_sitelib}/%{name}/__pycache__
%{python3_sitelib}/%{name}/__pycache__/*.pyc
%{python3_sitelib}/%{name}-%{version}*-py*.egg-info
%{_mandir}/man1/%{name}.1*
%changelog