d44f679
# test are enabled by default
f1a24a2
%bcond_without tests
f1a24a2
d44f679
# let tests run on all arches
d44f679
%global debug_package %{nil}
f1a24a2
f1a24a2
%global _description %{expand:
f1a24a2
PuLP is an LP modeler written in Python. PuLP can generate MPS or LP
f1a24a2
files and call GLPK, COIN-OR CLP/CBC, CPLEX, GUROBI, MOSEK, XPRESS,
f1a24a2
CHOCO, MIPCL, SCIP to solve linear problems.}
f1a24a2
d44f679
Name:           python-pulp
d2eafc8
Version:        2.8.0
0f868bb
Release:        %autorelease
f1a24a2
Summary:        A python Linear Programming API
f1a24a2
e8bec13
License:        BSD-1-Clause
f1a24a2
URL:            https://coin-or.github.io/pulp/
d44f679
Source0:        https://github.com/coin-or/pulp/archive/%{version}/pulp-%{version}.tar.gz
f1a24a2
d44f679
# https://github.com/sanjayankur31/pulp/tree/fedora-2.6.0
d44f679
# Do not install bundled cbc
d44f679
Patch0:         0001-Remove-bundled-cbc.patch
d44f679
Patch1:         0002-increase-test-verbosity.patch
f1a24a2
f1a24a2
BuildRequires:  python3-devel
f1a24a2
BuildRequires:  %{py3_dist setuptools}
d44f679
BuildRequires:  git-core
f1a24a2
f1a24a2
%if %{with tests}
f1a24a2
BuildRequires:  %{py3_dist amply}
d44f679
BuildRequires:  coin-or-Cbc
f1a24a2
%endif
f1a24a2
d44f679
# Solver
d44f679
# https://coin-or.github.io/pulp/main/installing_pulp_at_home.html?highlight=cbc
d44f679
Requires:       coin-or-Cbc
f1a24a2
d44f679
%description %_description
f1a24a2
d44f679
%package -n python3-pulp
bd62aad
Summary:        %{summary}
d44f679
BuildArch:      noarch
bd62aad
d44f679
%description -n python3-pulp %_description
bd62aad
f1a24a2
%prep
d44f679
%autosetup -n pulp-%{version} -S git
d44f679
d44f679
# remove bundled cbc
d44f679
rm -rf pulp/solverdir/cbc
f1a24a2
f1a24a2
find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'
f1a24a2
d44f679
%generate_buildrequires
d44f679
%pyproject_buildrequires
f1a24a2
d44f679
%build
d44f679
%pyproject_wheel
f1a24a2
f1a24a2
%install
d44f679
%pyproject_install
d44f679
4eac4ce
%pyproject_save_files -l pulp
f1a24a2
f1a24a2
%check
f1a24a2
# Using pulptest binary to test the package
f1a24a2
%if %{with tests}
f1a24a2
export PATH=$PATH:%{buildroot}%{_bindir}
f1a24a2
export PYTHONPATH=%{buildroot}%{python3_sitelib}
f1a24a2
pulptest
f1a24a2
%endif
f1a24a2
d44f679
%files -n python3-pulp -f %{pyproject_files}
fc24eb2
%doc README.rst HISTORY
f1a24a2
%{_bindir}/pulptest
bd62aad
f1a24a2
%changelog
0f868bb
%autochangelog