Blob Blame History Raw
%bcond_without tests
%global debug_package %{nil}

%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.5.0
Release:        1%{?dist}
Summary:        A python Linear Programming API

License:        BSD
URL:            https://coin-or.github.io/pulp/
Source0:        https://github.com/coin-or/%{src_name}/archive/%{version}/%{src_name}-%{version}.tar.gz

%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

%package -n python3-%{src_name}-doc
Summary:        %{summary}

BuildRequires:  make
BuildRequires:  %{py3_dist sphinx}
BuildRequires:  %{py3_dist sphinx_rtd_theme}

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

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

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

%build
%py3_build

pushd doc/
mkdir -p _build/doctrees
mkdir -p _build/html
make %{?_smp_mflags} html
popd

%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/

%files -n python3-%{src_name}-doc
%license LICENSE
%doc doc/_build/html/ doc/_build/doctrees/

%changelog
* Tue Aug 17 2021 Aniket Pradhan <major AT fedoraproject DOT org> - 2.5.0-1
- Updated to v2.5.0-1
- Added the docs subpackage
- Fixed a version typo in the 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> - 2.4-1
- Initial build