%bcond_with tests %global _description %{expand: C++ / Python reader for SONATA circuit files. SONATA guide: https://github.com/AllenInstitute/sonata/blob/master/docs/SONATA_DEVELOPER_GUIDE.md } Name: libsonata Version: 0.1.11 Release: %autorelease Summary: A Python and C++ interface to the SONATA format License: LGPLv3 URL: https://github.com/BlueBrain/libsonata Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz Patch0: 0001-include-catch-cmake.patch Patch1: 0002-use-cpp-17-filesystem.patch Patch2: 0003-Remove-pybind-redeclarations.patch Patch3: 0004-disable-python-ext-build.patch Patch4: 0005-set-libdir.patch BuildRequires: cmake BuildRequires: boost-devel BuildRequires: catch-devel BuildRequires: fmt-devel BuildRequires: json-devel BuildRequires: gcc-c++ BuildRequires: git-core BuildRequires: highfive-devel BuildRequires: hdf5-devel BuildRequires: pybind11-devel BuildRequires: python3-pybind11 %description %_description %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description devel %_description %package -n python3-libsonata Summary: %{summary} BuildRequires: python3-devel BuildRequires: python3-pip BuildRequires: python3-wheel BuildRequires: python3-setuptools BuildRequires: python3-setuptools_scm BuildRequires: python3-pytest %description -n python3-libsonata %_description %prep %autosetup -n libsonata-%{version} -S git rm -rf libsonata.egg-info rm -rf extlib/{Catch2,Highfive,fmt,nlohmann} # Unneeded file rm -rf python/libsonata/__init__.py # Comment out to remove /usr/bin/env shebangs # Can use something similar to correct/remove /usr/bin/python shebangs also # find . -type f -name "*.py" -exec sed -i '/^#![ ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';' %build %cmake -DSONATA_PYTHON=ON -DEXTLIB_FROM_SUBMODULES=OFF -DSONATA_VERSION="%{version}" -DSONATA_TESTS=ON -DSONATA_CXX_WARNINGS=OFF %cmake_build export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %pyproject_wheel %install %cmake_install # remove static lib rm -rf %{buildroot}/%{_libdir}/libsonata.a export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %pyproject_install %pyproject_save_files libsonata %check %ctest tests || true %pyproject_check_import libsonata #pushd python/tests #export PYTHONPATH=%%{buildroot}/%%{python3_sitearch}/ #%%{python3} -m unittest #popd %files %{_libdir}/libsonata.so.0.1 %{_libdir}/libsonata.so.0.1.11 %files devel %{_includedir}/bbp %{_datadir}/sonata/ %{_libdir}/libsonata.so %files -n python3-libsonata -f %{pyproject_files} %license COPYING COPYING.LESSER %doc README.rst CHANGELOG.md %changelog %autochangelog