From b33aa1837f0d35a582f6ff41fca2c6787504f5d7a0744dbd996036eb8aafb4a3 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Thu, 15 Sep 2022 22:15:13 +0000 Subject: [PATCH] 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 --- python-pybind11-rpmlintrc | 2 ++ python-pybind11.changes | 8 +++++++ python-pybind11.spec | 44 ++++++++++++++++++++++++++------------- 3 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 python-pybind11-rpmlintrc diff --git a/python-pybind11-rpmlintrc b/python-pybind11-rpmlintrc new file mode 100644 index 0000000..c0c81ce --- /dev/null +++ b/python-pybind11-rpmlintrc @@ -0,0 +1,2 @@ +# The ghost comes from pretrans +addFilter("ghost-files-without-postin") diff --git a/python-pybind11.changes b/python-pybind11.changes index 5fc88d2..801ed55 100644 --- a/python-pybind11.changes +++ b/python-pybind11.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Sep 15 20:25:44 UTC 2022 - Ben Greiner + +- %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 diff --git a/python-pybind11.spec b/python-pybind11.spec index fddbc87..997112a 100644 --- a/python-pybind11.spec +++ b/python-pybind11.spec @@ -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 +-- 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