14
0

Accepting request 1003972 from home:bnavigator:branches:devel:languages:python

- %pretrans must be lua
- requires python-rpm-macros >= 20220912 because of parameter in
  scriptlet
- Fix subdirectory links

OBS-URL: https://build.opensuse.org/request/show/1003972
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pybind11?expand=0&rev=37
This commit is contained in:
2022-09-15 22:15:13 +00:00
committed by Git OBS Bridge
parent 3e6bf1e682
commit b33aa1837f
3 changed files with 40 additions and 14 deletions

View File

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

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
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>

View File

@@ -31,6 +31,7 @@
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
%define plainpython python
Name: python-pybind11
Version: 2.10.0
Release: 0
@@ -38,12 +39,13 @@ 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
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-rpm-macros >= 20220912
%if %{with libalternatives}
Requires: alts
BuildRequires: alts
@@ -78,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.
@@ -117,11 +120,11 @@ popd
%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
ln -s %{_includedir}/pybind11 %{buildroot}%{$python_sitelib}/pybind11/include
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
ln -s %{_datadir}/cmake/pybind11 %{buildroot}%{$python_sitelib}/pybind11/share/cmake
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}
}
@@ -137,15 +140,26 @@ ignore_tests="$ignore_tests --ignore tests/extra_python_package/test_files.py"
%pytest $ignore_tests
%endif
%pretrans devel
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/
# rh#447156
# Do not bother with .rpmmoved suffix. This is a system controlled namespace,
for path in "%{python_sitelib}/pybind11/share/cmake" "%{python_sitelib}/pybind11/include"; do
if [ -d "$path" -a ! -L "$path" ]; then
rm -r "$path"
fi
done
%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.
@@ -175,7 +189,9 @@ done
%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