Blob Blame History Raw
%bcond_without tests

%global pypi_name PuLP
%global src_name pulp

%global _description %{expand:
PuLP is an LP modeler written in Python. PuLP can generate MPS or LP
files and call GLPK, COIN-OR CLP/CBC, CPLEX, GUROBI, MOSEK, XPRESS,
CHOCO, MIPCL, SCIP to solve linear problems.}

Name:           python-%{src_name}
Version:        2.4
Release:        3%{?dist}
Summary:        A python Linear Programming API

License:        BSD
URL:            https://coin-or.github.io/pulp/
Source0:        %{pypi_source}

BuildArch:      noarch

%description %_description

%package -n python3-%{src_name}
Summary:        %{summary}
BuildRequires:  python3-devel
BuildRequires:  %{py3_dist setuptools}

%if %{with tests}
BuildRequires:  %{py3_dist amply}
%endif

%py_provides python3-%{src_name}

%description -n python3-%{src_name} %_description

%prep
%autosetup -n %{pypi_name}-%{version}

find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'

%build
%py3_build

# Not including the doc subpackage for now, since it uses the glpi theme
# which is not packaged for now. The new release would contain the docs
# with the rtd theme which is packaged. Therefore the docs subpackage
# can be included with the next release.

%install
%py3_install

%check
# Using pulptest binary to test the package
%if %{with tests}
export PATH=$PATH:%{buildroot}%{_bindir}
export PYTHONPATH=%{buildroot}%{python3_sitelib}

pulptest
%endif

%files -n python3-%{src_name}
%doc README.rst
%license LICENSE

%{_bindir}/pulptest
%{python3_sitelib}/%{src_name}/
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/

%changelog
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 2.4-2
- Rebuilt for Python 3.10

* Sat Nov 21 2020 Aniket Pradhan <major AT fedoraproject DOT org> - 0.8.2-1
- Initial build