06f7832
# Tests are enabled
06f7832
%bcond_without tests
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
3d8afb1
Name:           python-SALib
6db2bdb
Version:        1.4.5
111d8d1
Release:        %autorelease
06f7832
Summary:        Sensitivity Analysis Library
06f7832
06f7832
License:        MIT
06f7832
URL:            http://salib.github.io/SALib/
6db2bdb
Source0:        https://github.com/SALib/SALib/archive/v%{version}/%{name}-%{version}.tar.gz
13522f5
06f7832
BuildArch:      noarch
06f7832
06f7832
%description %_description
06f7832
3d8afb1
%package -n python3-SALib
06f7832
Summary:        %{summary}
06f7832
BuildRequires:  python3-devel
13522f5
%if %{with tests}
13522f5
BuildRequires:  %{py3_dist pytest}
13522f5
BuildRequires:  %{py3_dist pytest-cov}
13522f5
%endif
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
3d8afb1
%description -n python3-SALib %_description
06f7832
06f7832
%prep
3d8afb1
%autosetup -n SALib-%{version}
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
b2d73b6
# https://github.com/SALib/SALib/commit/2eb776b6c7ff0737e4d9855709e6e24c19e36971.patch
b2d73b6
sed -i 's/rU/r/' src/SALib/util/__init__.py
b2d73b6
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
13522f5
%generate_buildrequires
73d0bfb
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
13522f5
%if %{with tests}
13522f5
%pyproject_buildrequires -r
13522f5
%else
13522f5
%pyproject_buildrequires
13522f5
%endif
13522f5
06f7832
%build
73d0bfb
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
13522f5
%pyproject_wheel
06f7832
06f7832
%install
73d0bfb
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
13522f5
%pyproject_install
3d8afb1
%pyproject_save_files SALib
06f7832
06f7832
# Add a shebang to missing script
c42d1ab
sed -i "1 i \#\!%{python3}" $RPM_BUILD_ROOT/%{_bindir}/salib.py
06f7832
06f7832
%check
06f7832
%if %{with tests}
73d0bfb
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
13522f5
PYTHONPATH=$RPM_BUILD_ROOT%{python3_sitelib} %{pytest}
06f7832
%endif
06f7832
3d8afb1
%files -n python3-SALib -f %{pyproject_files}
13522f5
%doc README.rst README-advanced.md CHANGELOG.md CITATIONS.rst AUTHORS.rst FAQ.MD
06f7832
%{_bindir}/salib
06f7832
%{_bindir}/salib.py
06f7832
06f7832
%changelog
111d8d1
%autochangelog