## START: Set by rpmautospec ## (rpmautospec version 0.2.5) %define autorelease(e:s:pb:) %{?-p:0.}%{lua: release_number = 1; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{?dist} ## END: Set by rpmautospec %global _description %{expand: MorphIO is a library for reading and writing neuron morphology files. It supports the following formats: - SWC - ASC (aka. neurolucida) - H5 v1 - H5 v2 is not supported anymore It provides 3 C++ classes that are the starting point of every morphology analysis: - Soma: contains the information related to the soma. - Section: a section is the succession of points between two bifurcations. To the bare minimum the Section object will contain the section type, the position and diameter of each point. - Morphology: the morphology object contains general information about the loaded cell but also provides accessors to the different sections. One important concept is that MorphIO is split into a read-only part and a read/write one. } %global pretty_name MorphIO # cpp tests %bcond_without tests # python tests %bcond_without pytests Name: morphio Version: 3.3.3 Release: %autorelease Summary: A python and C++ library for reading and writing neuronal morphologies # The entire source is LGPLv3 except the following, which are BSD: # - CMake/CodeCoverage.cmake # The “effective license” remains LGPLv3. License: LGPLv3 URL: https://github.com/BlueBrain/MorphIO Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz # Patches # https://github.com/sanjayankur31/MorphIO/tree/fedora-3.3.2 # Some sent upstream: https://github.com/BlueBrain/MorphIO/pull/293 # Do not let cmake use $FLAGS env var Patch0: 0001-Stop-them-using-a-random-env-var.patch # Use CMake GNUInstallDirs to install things in the right places Patch1: 0002-Use-gnuinstall-dirs.patch # Remove more hard-coded compiler flags Patch2: 0003-Remove-upstreams-flags.patch # Set a shared object version (0.0.0) Patch3: 0004-Version-soname.patch # Add install target for the compiled python module Patch4: 0005-Install-python-shared-object.patch # Stop setup.py from running the cmake build, we’ll run it ourselves Patch5: 0006-Stop-setup.py-from-cmake-build.patch # Some Python tests are failing because “expected” results are float32 and then # promoted back to float64 for comparison with the actual results. We are not # sure why upstream is not experiencing this. Patch6: 0007-pytest-float32.patch # use LIB_INSTALL_DIR which is defined by %%cmake Patch7: 0008-use-lib_install_dir.patch BuildRequires: hdf5-devel BuildRequires: boost-devel %if %{with tests} BuildRequires: catch-devel %endif BuildRequires: gcc-c++ BuildRequires: cmake # Our choice: the make backend works fine too BuildRequires: ninja-build # Header-only libraries; -static required by guidelines for tracking BuildRequires: cmake(gsl-lite) BuildRequires: gsl-lite-static BuildRequires: cmake(highfive) BuildRequires: highfive-static BuildRequires: lexertl14-devel BuildRequires: lexertl14-static # We cannot currently figure out how to unbundle this: BuildRequires: cmake(pybind11) BuildRequires: pybind11-static %description %_description %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} Provides: %{name}-static = %{version}-%{release} # A gsl header is included from the public morphio/types.h header. Requires: gsl-lite-devel%{?_isa} Requires: gsl-lite-static # A HighFive header is included from the public morphio/morphology.h header. Requires: highfive-devel%{?_isa} Requires: highfive-static # Note that packages using this -devel package should ideally also BR # gsl-lite-static and highfive-static for header-only library tracking. %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %package -n python3-%{name} Summary: Python bindings for %{name} BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-setuptools_scm %if %{with pytests} # tests/requirements-tests.txt BuildRequires: %{py3_dist h5py} >= 2.9.0 BuildRequires: %{py3_dist pytest} >= 6.0 BuildRequires: %{py3_dist numpy} >= 1.14.2 BuildRequires: %{py3_dist requests} >= 2.25.1 %endif # Note that this package does not depend at all on the base package (it does # not link against the shared library). %description -n python3-%{name} This package includes the Python 3 bindings for %{name}. %package doc Summary: Documentation for %{name} BuildArch: noarch %description doc This package provides documentation for %{name} %prep %autosetup -n %{pretty_name}-%{version} -p1 # Unbundle gsl-lite rm -rvf 3rdparty/GSL_LITE sed -r -i '/GSL_LITE/d' MANIFEST.in sed -r -i '/director.*\(.*(gsl-lite|GSL_LITE).*\)/d' 3rdparty/CMakeLists.txt sed -r -i \ -e '/TARGET_PROPERTY:gsl-lite,INTERFACE_INCLUDE_DIRECTORIES/d' \ -e 's/PUBLIC[[:blank:]]+gsl-lite[[:blank:]]+(PRIVATE)/\1/' \ src/CMakeLists.txt # Update includes. Note that this affects the public API headers. # # The grep-then-sed pattern means we only modify those files that need it, # preserving the mtimes on the others. grep -ErIl '#[[:blank:]]*include[[:blank:]]+["<]gsl/gsl[">]' . | xargs -r sed -r -i \ 's@(#[[:blank:]]*include[[:blank:]]+["<]gsl/gsl)([">])@\1-lite\.hpp\2@' # Unbundle lexertl rm -rvf '3rdparty/lexertl' ln -s '%{_includedir}/lexertl' '3rdparty/' # Some of these could make it into the installed package: find . -type f -name .gitignore -print -delete %build export SETUPTOOLS_SCM_PRETEND_VERSION='%{version}' %cmake \ -DEXTERNAL_PYBIND11:BOOL=TRUE \ -DEXTERNAL_HIGHFIVE:BOOL=TRUE \ -DMORPHIO_USE_DOUBLE:BOOL=TRUE \ -DBUILD_BINDINGS:BOOL=TRUE \ -DMorphIO_CXX_WARNINGS:BOOL=FALSE \ -DMORPHIO_TESTS:BOOL=%{?with_tests:TRUE}%{?!with_tests:FALSE} \ -DEXTERNAL_CATCH2:BOOL=TRUE \ -DMORPHIO_ENABLE_COVERAGE:BOOL=TRUE \ -DMORPHIO_USE_DOUBLE:BOOL=TRUE \ -DMORPHIO_VERSION_STRING:STRING="%{version}" \ -GNinja %cmake_build # Build pure python bits %py3_build %install export SETUPTOOLS_SCM_PRETEND_VERSION='%{version}' %cmake_install # Install pure python bits %py3_install # Move module to sitearch so that the binding can be correctly imported. if [ '%{python3_sitelib}' != '%{python3_sitearch}' ] then mv -v $RPM_BUILD_ROOT/%{python3_sitelib}/%{name}/* \ $RPM_BUILD_ROOT/%{python3_sitearch}/%{name} mv -v $RPM_BUILD_ROOT/%{python3_sitelib}/%{pretty_name}* \ $RPM_BUILD_ROOT/%{python3_sitearch}/ fi %check export SETUPTOOLS_SCM_PRETEND_VERSION='%{version}' %if %{with tests} # From ci/cpp_test.sh %ctest %endif %if %{with pytests} # We will change directories so that the “un-built” package is not imported xdir="$(basename "${PWD}")" # From ci/python_test.sh cd .. # Fetches from the Internet: k='not test_v2' # Still fails in 3.3.3 # TODO: Is this a real problem? The answer is only slightly outside tolerances. # # > assert_array_almost_equal(neuron.markers[0].points, # np.array([[81.58, -77.98, -20.32]], dtype=np.float32)) # E AssertionError: # E Arrays are not almost equal to 6 decimals # E # E Mismatched elements: 2 / 3 (66.7%) # E Max absolute difference: 3.35693359e-06 # E Max relative difference: 4.30486464e-08 # E x: array([[ 81.58, -77.98, -20.32]]) # E y: array([[ 81.58, -77.98, -20.32]], dtype=float32) k="${k} and not test_neurolucida_markers" # Still fails to 3.3.3 # TODO: Is this a real problem? The answer is only slightly outside tolerances. # # > assert_array_equal(m.markers[0].points, np.array([[ -0.97 , -141.169998, 84.769997]], # dtype=np.float32)) # E AssertionError: # E Arrays are not equal # E # E Mismatched elements: 3 / 3 (100%) # E Max absolute difference: 3.35693359e-06 # E Max relative difference: 3.96004922e-08 # E x: array([[ -0.97, -141.17, 84.77]]) # E y: array([[ -0.97, -141.17, 84.77]], dtype=float32) k="${k} and not test_marker_with_string" # TODO: pytest segfaults while writing a temporary file.. k="${k} and not test_dendritic_spine_round_trip_empty_postsynaptic_density" %pytest "${xdir}/tests" -k "${k}" -v %endif %files %license COPYING COPYING.LESSER %{_libdir}/libmorphio.so.0.0.0 %files devel %{_includedir}/%{name} %{_libdir}/libmorphio.so %{_libdir}/cmake/%{pretty_name} %files -n python3-%{name} %license COPYING COPYING.LESSER %{python3_sitearch}/%{name} %{python3_sitearch}/%{pretty_name}-%{version}-py%{python3_version}.egg-info %files doc %license COPYING COPYING.LESSER %doc CHANGELOG.md CONTRIBUTING.md README.rst examples %changelog * Thu Mar 03 2022 Ankur Sinha (Ankur Sinha Gmail) 3.3.3-1 - feat: update to 3.3.3 (fixes rhbz#2060432) * Thu Mar 03 2022 Ankur Sinha (Ankur Sinha Gmail) 3.3.2-3 - feat: clean up spec * Mon Feb 28 2022 Benjamin A. Beasley 3.3.2-2 - Rebuild for lexertl14 cd5a1f1 (Unicode 15) * Mon Feb 21 2022 Ankur Sinha (Ankur Sinha Gmail) 3.3.2-1 - feat: update to 3.3.2 (fixes rhbz#2021598) * Thu Jan 20 2022 Fedora Release Engineering - 3.3.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild * Sun Nov 21 2021 Orion Poplawski - 3.3.0-3 - Rebuild for hdf5 1.12.1 * Fri Nov 05 2021 Benjamin A. Beasley - 3.3.0-2 - Rebuild with gsl-lite 0.40.0 * Wed Aug 25 2021 Benjamin A. Beasley - 3.3.0-1 - Update to 3.3.0 - Use cmake(…) dependencies where appropriate - Unbundle lexertl14 - Remove ExcludeArch on i686 and armv7hl since these are fixed in highfive (and an additional problem on armv7hl is fixed here) - Add license files to -doc subpackage; drop text doc files from others - Enable Sphinx documentation (with an alternative theme) - Use SETUPTOOLS_SCM_PRETEND_VERSION instead of a local git repo - Enable Python tests - Add header-only dependencies present in the public API to the -devel package * Thu Jul 22 2021 Fedora Release Engineering - 3.0.2-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild * Fri Jun 04 2021 Python Maint - 3.0.2-2 - Rebuilt for Python 3.10 * Thu Apr 22 2021 Ankur Sinha - 3.0.2-1 - Add excludearch because of highfive - do not carry licenses in devel package, since it depends on the main package already * Wed Apr 21 2021 Ankur Sinha - 3.0.2-1 - Enable tests * Sat Apr 17 2021 Ankur Sinha - 3.0.2-1 - Initial build