commit ee7c0d844c57478e5bae0b62fc9912e4615b56d9 Author: CentOS Sources Date: Tue Mar 28 13:08:32 2023 +0000 import python3.11-pybind11-2.10.3-2.el8 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4642c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/pybind11-2.10.3.tar.gz diff --git a/.python3.11-pybind11.metadata b/.python3.11-pybind11.metadata new file mode 100644 index 0000000..f374f5b --- /dev/null +++ b/.python3.11-pybind11.metadata @@ -0,0 +1 @@ +6cd93bee0447ec432803c005fdcdeadc5d425c6d SOURCES/pybind11-2.10.3.tar.gz diff --git a/SOURCES/pybind11-2.10.1-hpath.patch b/SOURCES/pybind11-2.10.1-hpath.patch new file mode 100644 index 0000000..c615c6d --- /dev/null +++ b/SOURCES/pybind11-2.10.1-hpath.patch @@ -0,0 +1,28 @@ +diff -uNr pybind11-2.10.1.bak/pybind11/commands.py pybind11-2.10.1/pybind11/commands.py +--- pybind11-2.10.1.bak/pybind11/commands.py 2022-11-07 15:25:26.651515082 -0600 ++++ pybind11-2.10.1/pybind11/commands.py 2022-11-07 15:27:01.574703289 -0600 +@@ -8,22 +8,13 @@ + Return the path to the pybind11 include directory. The historical "user" + argument is unused, and may be removed. + """ +- installed_path = os.path.join(DIR, "include") +- source_path = os.path.join(os.path.dirname(DIR), "include") +- return installed_path if os.path.exists(installed_path) else source_path +- ++ return '/usr/include/pybind11' + + def get_cmake_dir() -> str: + """ + Return the path to the pybind11 CMake module directory. + """ +- cmake_installed_path = os.path.join(DIR, "share", "cmake", "pybind11") +- if os.path.exists(cmake_installed_path): +- return cmake_installed_path +- +- msg = "pybind11 not installed, installation required to access the CMake files" +- raise ImportError(msg) +- ++ return '/usr/share/cmake/pybind11' + + def get_pkgconfig_dir() -> str: + """ diff --git a/SPECS/python3.11-pybind11.spec b/SPECS/python3.11-pybind11.spec new file mode 100644 index 0000000..dd817cf --- /dev/null +++ b/SPECS/python3.11-pybind11.spec @@ -0,0 +1,131 @@ +%global __python3 /usr/bin/python3.11 +%global python3_pkgversion 3.11 + +# While the headers are architecture independent, the package must be +# built separately on all architectures so that the tests are run +# properly. See also +# https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Header_Only_Libraries +%global debug_package %{nil} + +# Whether to run the tests, enabled by default +%bcond_without tests + +%global modname pybind11 + +Name: python%{python3_pkgversion}-pybind11 +Version: 2.10.3 +Release: 2%{?dist} +Summary: Seamless operability between C++11 and Python +License: BSD +URL: https://github.com/pybind/pybind11 +Source0: https://github.com/pybind/pybind11/archive/v%{version}/%{modname}-%{version}.tar.gz + +# Patch out header path +Patch1: pybind11-2.10.1-hpath.patch + +BuildRequires: make + +# Needed to build the python libraries +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-rpm-macros +BuildRequires: python%{python3_pkgversion}-setuptools +# These are only needed for the checks +%if %{with tests} +BuildRequires: python%{python3_pkgversion}-pytest +BuildRequires: python%{python3_pkgversion}-numpy +BuildRequires: python%{python3_pkgversion}-scipy +%endif + +BuildRequires: eigen3-devel +BuildRequires: gcc-c++ +BuildRequires: cmake + +Requires: %{name}-devel%{?_isa} = %{version}-%{release} + +%global base_description \ +pybind11 is a lightweight header-only library that exposes C++ types \ +in Python and vice versa, mainly to create Python bindings of existing \ +C++ code. + +%description +%{base_description} + +%package devel +Summary: Development headers for pybind11 + +# This package does not have namespaced file locations, so if we build the +# pybind11-devel subpackage in any other stack as well, the files from these +# packages will conflict. The package name is namespaced so that customers can +# decide which to install, but the packages will conflict with each other. +Provides: %{modname}-devel = %{version}-%{release} +Conflicts: %{modname}-devel < %{version}-%{release} + +# https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Header_Only_Libraries +Provides: %{modname}-static = %{version}-%{release} +Provides: %{name}-static = %{version}-%{release} +# For dir ownership +Requires: cmake + +%description devel +%{base_description} + +This package contains the development headers for pybind11. + +%prep +%autosetup -p1 -n %{modname}-%{version} + +%build +py=python3 +mkdir $py +# When -DCMAKE_BUILD_TYPE is set to Release, the tests in %%check might segfault. +# However, we do not ship any binaries, and therefore Debug +# build type does not affect the results. +# https://bugzilla.redhat.com/show_bug.cgi?id=1921199 +%if 0%{?rhel} < 9 +cd $py +%cmake .. -DCMAKE_BUILD_TYPE=Debug -DPYTHON_EXECUTABLE=%{__python3} -DPYBIND11_INSTALL=TRUE -DUSE_PYTHON_INCLUDE_DIR=FALSE %{!?with_tests:-DPYBIND11_TEST=OFF} +%make_build +cd .. +%else +%cmake -B $py -DCMAKE_BUILD_TYPE=Debug -DPYTHON_EXECUTABLE=%{__python3} -DPYBIND11_INSTALL=TRUE -DUSE_PYTHON_INCLUDE_DIR=FALSE %{!?with_tests:-DPYBIND11_TEST=OFF} +%make_build -C $py +%endif + +%py3_build + +%if %{with tests} +%check +make -C python3 check %{?_smp_mflags} +%endif + +%install +%make_install -C python3 +# Force install to arch-ful directories instead. +PYBIND11_USE_CMAKE=true %py3_install "--install-purelib" "%{python3_sitearch}" + +%files devel +%license LICENSE +%doc README.rst +%{_includedir}/pybind11/ +%{_datadir}/cmake/pybind11/ +%{_bindir}/pybind11-config +%{_datadir}/pkgconfig/%{modname}.pc + +%files +%{python3_sitearch}/%{modname}/ +%{python3_sitearch}/%{modname}-%{version}-py%{python3_version}.egg-info + +%changelog +* Mon Feb 20 2023 Charalampos Stratakis - 2.10.3-2 +- Enable tests + +* Thu Dec 01 2022 Charalampos Stratakis - 2.10.3-1 +- Initial package +- Fedora contributions by: + Elliott Sales de Andrade + Jonathan + jonathanspw + Merlin Mathesius + Miro HronĨok + Susi Lehtola + Tom Stellard