%global pypi_name osqp # The OSQP C solver and its QDLDL factorisation, which upstream's CMake fetches # from GitHub at configure time (FetchContent). Neither is packaged in Fedora; # they are compiled statically into the extension. %global osqp_c_version 1.0.0 %global qdldl_version 0.1.8 Name: python-%{pypi_name} Version: 1.1.3 Release: 1%{?dist} Summary: OSQP, the operator splitting quadratic program solver License: Apache-2.0 URL: https://osqp.org/ Source0: %{pypi_source %{pypi_name}} Source1: https://github.com/osqp/osqp/archive/v%{osqp_c_version}/osqp-%{osqp_c_version}.tar.gz Source2: https://github.com/osqp/qdldl/archive/v%{qdldl_version}/qdldl-%{qdldl_version}.tar.gz BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros BuildRequires: python3dist(pytest) # osqp.nn.torch (a differentiable QP layer) and its tests BuildRequires: python3dist(torch) %global _description %{expand: OSQP solves convex quadratic programs, minimising 1/2 x'Px + q'x subject to l <= Ax <= u, with an ADMM operator-splitting method that needs one matrix factorisation and copes with infeasible and ill-conditioned problems. The Python interface supports warm starts, problem updates without refactoring, derivatives of the solution and generation of embeddable C code. This package builds the default ("builtin") linear algebra backend; the MKL and CUDA backends are separate upstream projects.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} Provides: bundled(osqp) = %{osqp_c_version} Provides: bundled(qdldl) = %{qdldl_version} Suggests: python3dist(torch) %description -n python3-%{pypi_name} %_description %prep %autosetup -n %{pypi_name}-%{version} mkdir -p _deps tar -xzf %{SOURCE1} -C _deps tar -xzf %{SOURCE2} -C _deps %generate_buildrequires %pyproject_buildrequires %build export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} # Point both FetchContent declarations at the tarballs and forbid downloads. # RelWithDebInfo, because pybind11_add_module strips the module after linking # in Release builds, leaving nothing for -debuginfo. Its flags are reset so # Fedora's optimisation flags apply (the CMake defaults add -O2/-O3 -g). export SKBUILD_CMAKE_BUILD_TYPE=RelWithDebInfo export SKBUILD_CMAKE_ARGS="-DCMAKE_C_FLAGS_RELWITHDEBINFO=-DNDEBUG;-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-DNDEBUG;-DFETCHCONTENT_FULLY_DISCONNECTED=ON;-DFETCHCONTENT_SOURCE_DIR_OSQP=$PWD/_deps/osqp-%{osqp_c_version};-DFETCHCONTENT_SOURCE_DIR_QDLDL=$PWD/_deps/qdldl-%{qdldl_version}" export SKBUILD_BUILD_VERBOSE=true # scikit-build-core strips the extension on install by default, which leaves # rpm nothing to split into -debuginfo/-debugsource. export SKBUILD_INSTALL_STRIP=false %pyproject_wheel %install %pyproject_install %pyproject_save_files %{pypi_name} %check %pyproject_check_import -e 'osqp.cuda' -e 'osqp.mkl' -e 'osqp.tests.*' # Upstream's suite against the installed module. The codegen tests compile and # import generated C extensions at run time; skipped. cd %{_builddir} # osqp/tests has no __init__.py, so it is collected by path. %pytest -v %{buildroot}%{python3_sitearch}/osqp/tests \ --ignore-glob='*/codegen_*_test.py' %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %doc README.md %changelog * Fri Oct 16 2026 Morgan Hough - 1.1.3-1 - Initial package (pyAFQ's multi-shell deconvolution model). Builds OSQP C 1.0.0 and QDLDL 0.1.8 from tarballs instead of fetching them.