14
0

Accepting request 1003975 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1003975
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pybind11?expand=0&rev=18
This commit is contained in:
2022-09-17 18:08:23 +00:00
committed by Git OBS Bridge
6 changed files with 234 additions and 24 deletions

3
_multibuild Normal file
View File

@@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

3
pybind11-2.10.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:eacf582fa8f696227988d08cfc46121770823839fe9e301a20fbce67e7cd70ec
size 716362

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6bd528c4dbe2276635dc787b6b1f2e5316cf6b49ee3e150264e455a0d68d19c1
size 709521

View File

@@ -0,0 +1,2 @@
# The ghost comes from pretrans
addFilter("ghost-files-without-postin")

View File

@@ -1,3 +1,141 @@
-------------------------------------------------------------------
Thu Sep 15 20:25:44 UTC 2022 - Ben Greiner <code@bnavigator.de>
- %pretrans must be lua
- requires python-rpm-macros >= 20220912 because of parameter in
scriptlet
- Fix subdirectory links
-------------------------------------------------------------------
Wed Sep 14 21:02:16 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Work around long standing rpm-directory-to-symlink-bug
* https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/
* rh#447156
* use shell instead of lua for pretrans scriptlet
-------------------------------------------------------------------
Sun Sep 11 00:15:11 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to 2.10.0
* Removed support for Python 2.7, Python 3.5, and MSVC 2015.
Support for MSVC 2017 is limited due to availability of CI
runners; we highly recommend MSVC 2019 or 2022 be used.
Initial support added for Python 3.11.
* New features:
+ py::anyset & py::frozenset were added, with copying (cast)
to std::set (similar to set). #3901
+ Support bytearray casting to string. #3707
+ type_caster<std::monostate> was added. std::monostate is a
tag type that allows std::variant to act as an optional, or
allows default construction of a std::variant holding a
non-default constructible type. #3818
+ pybind11::capsule::set_name added to mutate the name of the
capsule instance. #3866
+ NumPy: dtype constructor from type number added, accessors
corresponding to Python API dtype.num, dtype.byteorder,
dtype.flags and dtype.alignment added. #3868
* Changes:
+ Python 3.6 is now the minimum supported version. #3688 #3719
+ The minimum version for MSVC is now 2017. #3722
+ Fix issues with CPython 3.11 betas and add to supported test
matrix. #3923
+ error_already_set is now safer and more performant,
especially for exceptions with long tracebacks, by delaying
computation. #1895
+ Improve exception handling in python str bindings. #3826
+ The bindings for capsules now have more consistent exception
handling. #3825
+ PYBIND11_OBJECT_CVT and PYBIND11_OBJECT_CVT_DEFAULT macro
can now be used to define classes in namespaces other than
pybind11. #3797
+ Error printing code now uses
PYBIND11_DETAILED_ERROR_MESSAGES instead of requiring
NDEBUG, allowing use with release builds if desired. #3913
+ Implicit conversion of the literal 0 to pybind11::handle is
now disabled. #4008
* Bug fixes:
+ Fix exception handling when pybind11::weakref() fails. #3739
+ module_::def_submodule was missing proper error handling.
This is fixed now. #3973
+ The behavior or error_already_set was made safer and the
highly opaque "Unknown internal error occurred" message was
replaced with a more helpful message. #3982
+ error_already_set::what() now handles non-normalized
exceptions correctly. #3971
+ Support older C++ compilers where filesystem is not yet part
of the standard library and is instead included in
std::experimental::filesystem. #3840
+ Fix -Wfree-nonheap-object warnings produced by GCC by
avoiding returning pointers to static objects with
return_value_policy::take_ownership. #3946
+ Fix cast from pytype rvalue to another pytype. #3949
+ Ensure proper behavior when garbage collecting classes with
dynamic attributes in Python >=3.9. #4051
+ A couple long-standing PYBIND11_NAMESPACE
__attribute__((visibility("hidden"))) inconsistencies are
now fixed (affects only unusual environments). #4043
+ pybind11::detail::get_internals() is now resilient to
in-flight Python exceptions. #3981
+ Arrays with a dimension of size 0 are now properly converted
to dynamic Eigen matrices (more common in NumPy 1.23). #4038
+ Avoid catching unrelated errors when importing NumPy. #3974
* Performance and style:
+ Added an accessor overload of (object &&key) to reference
steal the object when using python types as keys. This
prevents unnecessary reference count overhead for attr,
dictionary, tuple, and sequence look ups. Added additional
regression tests. Fixed a performance bug the caused
accessor assignments to potentially perform unnecessary
copies. #3970
+ Perfect forward all args of make_iterator. #3980
+ Avoid potential bug in pycapsule destructor by adding an
error_guard to one of the dtors. #3958
+ Optimize dictionary access in strip_padding for numpy. #3994
+ stl_bind.h bindings now take slice args as a const-ref.
#3852
+ Made slice constructor more consistent, and improve
performance of some casters by allowing reference stealing.
#3845
+ Change numpy dtype from_args method to use const ref. #3878
+ Follow rule of three to ensure PyErr_Restore is called only
once. #3872
+ Added missing perfect forwarding for make_iterator
functions. #3860
+ Optimize c++ to python function casting by using the rvalue
caster. #3966
+ Optimize Eigen sparse matrix casting by removing unnecessary
temporary. #4064
+ Avoid potential implicit copy/assignment constructors
causing double free in strdup_gaurd. #3905
+ Enable clang-tidy checks misc-definitions-in-headers,
modernize-loop-convert, and modernize-use-nullptr. #3881
#3988
* Build system improvements:
+ CMake: Fix file extension on Windows with cp36 and cp37
using FindPython. #3919
+ CMake: Support multiple Python targets (such as on vcpkg).
#3948
+ CMake: Fix issue with NVCC on Windows. #3947
+ CMake: Drop the bitness check on cross compiles (like
targeting WebAssembly via Emscripten). #3959
+ Add MSVC builds in debug mode to CI. #3784
+ MSVC 2022 C++20 coverage was added to GitHub Actions,
including Eigen. #3732, #3741
* Backend and tidying up:
+ New theme for the documentation. #3109
+ Remove idioms in code comments. Use more inclusive language.
#3809
+ #include <iostream> was removed from the pybind11/stl.h
header. Your project may break if it has a transitive
dependency on this include. The fix is to "Include What You
Use". #3928
+ Avoid setup.py <command> usage in internal tests. #3734
- Fix header deduplication: pybind11.get_include still reports
the headers to be in the sitelib (SciPy meson build fail)
- Test in multibuild as some tests expect the system-wide
%_includedir/pybind11/pybind11.h
-------------------------------------------------------------------
Sat Apr 9 22:47:00 UTC 2022 - Dirk Müller <dmueller@suse.com>
@@ -25,7 +163,7 @@ Sun Mar 27 15:11:08 UTC 2022 - Dirk Müller <dmueller@suse.com>
exceptions occur in the caster.
* Add a mapping of C++11 nested exceptions to their Python exception
equivalent using py::raise_from. This attaches the nested exceptions in
Python using the __cause__ field.
Python using the __cause__ field.
* Propagate Python exception traceback using raise_from if a pybind11
function runs out of overloads.
* py::multiple_inheritance is now only needed when C++ bases are hidden from
@@ -287,7 +425,7 @@ Fri Jul 17 01:00:06 UTC 2020 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
-------------------------------------------------------------------
Mon Jul 6 14:56:54 UTC 2020 - Christian Goll <cgoll@suse.com>
- updated to version 2.5.0 and running the internal unit tests now
- updated to version 2.5.0 and running the internal unit tests now
-------------------------------------------------------------------
Thu Apr 23 10:05:00 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>

View File

@@ -16,28 +16,36 @@
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%bcond_without test
%else
%bcond_with test
%endif
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
%endif
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
%define plainpython python
Name: python-pybind11
Version: 2.9.2
Version: 2.10.0
Release: 0
Summary: Module for operability between C++11 and Python
License: BSD-3-Clause
URL: https://github.com/pybind/pybind11
Source: https://github.com/pybind/pybind11/archive/v%{version}.tar.gz#/pybind11-%{version}.tar.gz
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pytest}
Source99: python-pybind11-rpmlintrc
BuildRequires: %{python_module devel >= 3.6}
BuildRequires: %{python_module setuptools}
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: python-rpm-macros >= 20210929
BuildRequires: %{python_module numpy if (%python-base without python36-base)}
BuildRequires: python-rpm-macros >= 20220912
%if %{with libalternatives}
Requires: alts
BuildRequires: alts
@@ -45,6 +53,12 @@ BuildRequires: alts
Requires(post): update-alternatives
Requires(postun):update-alternatives
%endif
%if %{with test}
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pybind11-devel = %{version}}
BuildRequires: %{python_module pytest-timeout}
BuildRequires: %{python_module pytest}
%endif
BuildArch: noarch
%python_subpackages
@@ -66,6 +80,7 @@ Summary: Development files for pybind11
Requires: %{name}-common-devel = %{version}
Requires: python-devel
Requires: python-pybind11 = %{version}
Requires: %{plainpython}(abi) = %{python_version}
%description devel
This package contains files for developing applications using pybind11.
@@ -74,33 +89,77 @@ This package contains files for developing applications using pybind11.
%setup -q -n pybind11-%{version}
%build
%if !%{with test}
%python_build
# calling cmake to install header to right location and
# generate cmake include files
%{python_expand pushd .
%cmake \
-DPYBIND11_INSTALL=ON \
-DPYBIND11_TEST=ON \
-DPYTHON_EXECUTABLE:FILEPATH=%{_bindir}/$python \
-DPYBIND11_TEST=OFF \
-DPYTHON_EXECUTABLE:FILEPATH=%{_bindir}/$python
%cmake_build
popd
}
%else
%{python_expand pushd .
%cmake \
-DPYBIND11_INSTALL=OFF \
-DPYBIND11_TEST=ON \
-DPYTHON_EXECUTABLE:FILEPATH=%{_bindir}/$python
%cmake_build
popd
}
%endif
%install
%if !%{with test}
%python_install
%python_clone -a %{buildroot}%{_bindir}/pybind11-config
%python_expand %cmake_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
# removing duplicated header files
rm -rfv %{buildroot}%{_includedir}/python2.*/pybind11/
rm -rfv %{buildroot}%{_includedir}/python3.*/pybind11
%{python_expand #
%cmake_install
# remove duplicated header files from sitelibs but link to common dirs as some
# packages expect them to be in the sitelib where pybind11.get_include() reports them.
rm -r %{buildroot}%{$python_sitelib}/pybind11/include/pybind11
ln -s %{_includedir}/pybind11 %{buildroot}%{$python_sitelib}/pybind11/include/pybind11
# same for cmake files: pybind11.get_cmake_dir()
rm -r %{buildroot}%{$python_sitelib}/pybind11/share/cmake/pybind11
ln -s %{_datadir}/cmake/pybind11 %{buildroot}%{$python_sitelib}/pybind11/share/cmake/pybind11
# note: next release will also include pkg-config files here: https://github.com/pybind/pybind11/pull/4077
%fdupes %{buildroot}%{$python_sitelib}
}
%endif
%if %{with test}
%check
# test fails as python3-widget is not in distribuion
rm -v tests/test_embed/test_interpreter.py tests/test_embed/test_trampoline.py
export PYTHONPATH=${PWD}/build/tests/
%pytest -k 'not (tests_build_wheel or tests_build_global_wheel)'
# tests fail as python3-widget is not in distribuion
ignore_tests="--ignore tests/test_embed/test_interpreter.py --ignore tests/test_embed/test_trampoline.py"
# no isolated build env with builddep wheels available
ignore_tests="$ignore_tests --ignore tests/extra_python_package/test_files.py"
%pytest $ignore_tests
%endif
%pretrans devel -p <lua>
-- https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/
-- rh#447156
-- Define the paths to directory being replaced in the below.
-- DO NOT add a trailing slash at the end.
paths = {"%{python_sitelib}/pybind11/share/cmake/pybind11", "%{python_sitelib}/pybind11/include/pybind11"}
for i, path in ipairs(paths) do
st = posix.stat(path)
if st and st.type == "directory" then
status = os.rename(path, path .. ".rpmmoved")
if not status then
suffix = 0
while not status do
suffix = suffix + 1
status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
end
os.rename(path, path .. ".rpmmoved")
end
end
end
%pre
# If libalternatives is used: Removing old update-alternatives entries.
@@ -112,19 +171,27 @@ export PYTHONPATH=${PWD}/build/tests/
%postun
%python_uninstall_alternative pybind11-config
%if !%{with test}
%files %{python_files}
%doc README.rst docs/changelog.rst
%license LICENSE
%python_alternative %{_bindir}/pybind11-config
%{python_sitelib}/pybind11*
%{python_sitelib}/pybind11
%exclude %{python_sitelib}/pybind11/share/cmake
%exclude %{python_sitelib}/pybind11/include
%{python_sitelib}/pybind11-%{version}*-info
%files -n %{name}-common-devel
%{_includedir}/pybind11
%license LICENSE
%{_includedir}/pybind11
%{_datadir}/cmake/pybind11
%files %{python_files devel}
%license LICENSE
%{python_sitelib}/pybind11/share/cmake
%ghost %{python_sitelib}/pybind11/share/cmake/pybind11.rpmmoved
%{python_sitelib}/pybind11/include
%ghost %{python_sitelib}/pybind11/include/pybind11.rpmmoved
%endif
%changelog