06f7832
# Tests are enabled
06f7832
%bcond_without tests
06f7832
06f7832
%global srcname SALib
06f7832
06f7832
%global _description %{expand:
06f7832
Python implementations of commonly used sensitivity analysis methods. Useful in
06f7832
systems modeling to calculate the effects of model inputs or exogenous factors
06f7832
on outputs of interest.
06f7832
06f7832
Herman, J. and Usher, W. (2017) SALib: An open-source Python library for
06f7832
sensitivity analysis. Journal of Open Source Software, 2(9).
06f7832
06f7832
Methods included:
06f7832
06f7832
- Sobol Sensitivity Analysis (Sobol 2001, Saltelli 2002, Saltelli et al. 2010)
06f7832
- Method of Morris, including groups and optimal trajectories (Morris 1991,
06f7832
  Campolongo et al. 2007)
06f7832
- Fourier Amplitude Sensitivity Test (FAST) (Cukier et al. 1973, Saltelli et
06f7832
  al. 1999)
06f7832
- Delta Moment-Independent Measure (Borgonovo 2007, Plischke et al. 2013)
06f7832
- Derivative-based Global Sensitivity Measure (DGSM) (Sobol and Kucherenko
06f7832
  2009)
06f7832
- Fractional Factorial Sensitivity Analysis (Saltelli et al. 2008)}
06f7832
06f7832
Name:           python-%{srcname}
25a0fb6
Version:        1.3.8
25a0fb6
Release:        1%{?dist}
06f7832
Summary:        Sensitivity Analysis Library
06f7832
06f7832
License:        MIT
06f7832
URL:            http://salib.github.io/SALib/
06f7832
Source0:        %pypi_source
25a0fb6
# Add patch for numpy 1.18 support
25a0fb6
# https://github.com/SALib/SALib/pull/280
25a0fb6
SOURCE1:        https://raw.githubusercontent.com/bsteubing/SALib/numpy_float_to_integer_issue/src/SALib/analyze/delta.py
06f7832
06f7832
BuildArch:      noarch
06f7832
06f7832
%{?python_enable_dependency_generator}
06f7832
06f7832
%description %_description
06f7832
06f7832
%package -n python3-%{srcname}
06f7832
Summary:        %{summary}
06f7832
BuildRequires:  python3-devel
06f7832
06f7832
# Not mentioned in setup.py, so won't be picked up by the generator
06f7832
Requires:  %{py3_dist pandas}
06f7832
Requires:  %{py3_dist numpy} >= 1.9.0
06f7832
Requires:  %{py3_dist scipy}
06f7832
Requires:  %{py3_dist matplotlib} >= 1.4.3
06f7832
06f7832
%if %{with tests}
06f7832
BuildRequires:  %{py3_dist pytest}
06f7832
BuildRequires:  %{py3_dist pytest-cov}
06f7832
BuildRequires:  %{py3_dist pandas}
06f7832
BuildRequires:  %{py3_dist numpy} >= 1.9.0
06f7832
BuildRequires:  %{py3_dist scipy}
06f7832
BuildRequires:  %{py3_dist matplotlib} >= 1.4.3
06f7832
BuildRequires:  %{py3_dist pyscaffold}
06f7832
%endif
06f7832
06f7832
%{?python_provide:%python_provide python3-%{srcname}}
06f7832
06f7832
%description -n python3-%{srcname} %_description
06f7832
06f7832
%package doc
06f7832
Summary:        %{summary}
06f7832
BuildRequires:  %{py3_dist sphinx}
06f7832
BuildRequires:  %{py3_dist recommonmark}
06f7832
06f7832
%description doc
06f7832
Documentation for %{name}.
06f7832
06f7832
%prep
06f7832
%autosetup -n %{srcname}-%{version}
06f7832
# Remove egg info
06f7832
rm -rf src/%{srcname}.egg-info
06f7832
# Remove uneeded version lock on pyscaffold
06f7832
sed -i "s/pyscaffold.*']/pyscaffold']/" setup.py
06f7832
06f7832
# python3, not python in tests
06f7832
sed -i 's/python {cli}/python3 {cli}/' tests/test_cli_sample.py
06f7832
sed -i 's/python {cli}/python3 {cli}/' tests/test_cli_analyze.py
06f7832
06f7832
# Correct permission
06f7832
chmod -x LICENSE.txt
06f7832
06f7832
# Remove /usr/bin/env python shebang
06f7832
find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'
06f7832
06f7832
# Correct end of line encoding
06f7832
sed -i 's/\r$//' LICENSE.txt
06f7832
sed -i 's/\r$//' src/SALib/analyze/rbd_fast.py
06f7832
25a0fb6
# Copy over fixed version of delta.py
25a0fb6
cp -v -p %{SOURCE1} ./src/SALib/analyze/delta.py
06f7832
06f7832
%build
06f7832
%py3_build
06f7832
06f7832
make -C docs SPHINXBUILD=sphinx-build-3 html
06f7832
rm -rf docs/_build/html/{.doctrees,.buildinfo} -vf
06f7832
06f7832
%install
06f7832
%py3_install
06f7832
06f7832
# Add a shebang to missing script
06f7832
sed -i "1 i \#\!%{__python3}" $RPM_BUILD_ROOT/%{_bindir}/salib.py
06f7832
06f7832
%check
06f7832
%if %{with tests}
06f7832
PYTHONPATH=$RPM_BUILD_ROOT%{python3_sitelib} pytest-%{python3_version}
06f7832
%endif
06f7832
06f7832
%files -n python3-%{srcname}
06f7832
%license LICENSE.txt
06f7832
%doc README.rst README-advanced.md CHANGELOG.rst CITATIONS.rst AUTHORS.rst
06f7832
%{python3_sitelib}/%{srcname}
06f7832
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info
06f7832
%{_bindir}/salib
06f7832
%{_bindir}/salib.py
06f7832
06f7832
%files doc
06f7832
%license LICENSE.txt
06f7832
%doc docs/_build/html
06f7832
06f7832
%changelog
25a0fb6
* Sun Feb 16 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 1.3.8-1
25a0fb6
- Update to latest release
25a0fb6
b51b91d
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.7-4
b51b91d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
b51b91d
c8ef6f1
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.3.7-3
c8ef6f1
- Rebuilt for Python 3.8.0rc1 (#1748018)
c8ef6f1
3740101
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.3.7-2
3740101
- Rebuilt for Python 3.8
3740101
06f7832
* Mon Aug 05 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 1.3.7-1
06f7832
- Update to new release
06f7832
06f7832
* Tue Jan 29 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 1.1.3-1
06f7832
- Initial build