File libvsmbr.spec of Package failed_libvsmbr

Name:           libvsmbr
Version:        20210509
Release:        1.1
Summary:        Virtual Storage Manager library

License:        GPL-2.0-or-later
Group:          System/Other
URL:            https://example.invalid/libvsmbr
Source0:        %{name}-%{version}.tar.xz
Patch0:         system-libs.patch

BuildRequires:  libtool, automake, autoconf, pkgconfig, python3-devel, gcc, make
Requires:       libbfio, libcerror, libcdata, libclocale, libcnotify, libcsplit, libuna, libcfile, libcpath, libfcache, libfdata, libcthreads

%description
libvsmbr - Virtual Storage Manager library and Python bindings.

%package -n python311-libvsmbr
Summary: Python 3.11 bindings for libvsmbr
Requires: python(abi) = 3.11

%description -n python311-libvsmbr
Python 3.11 bindings for libvsmbr.

%package -n python312-libvsmbr
Summary: Python 3.12 bindings for libvsmbr
Requires: python(abi) = 3.12

%description -n python312-libvsmbr
Python 3.12 bindings for libvsmbr.

%package -n python313-libvsmbr
Summary: Python 3.13 bindings for libvsmbr
Requires: python(abi) = 3.13

%description -n python313-libvsmbr
Python 3.13 bindings for libvsmbr.

%prep
%setup -q
%patch0 -p1

%build
%configure --disable-static --enable-wide-character-type --enable-python
%{__make} -j%{_smp_mflags}

%install
rm -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot} || exit 1

# Some build systems may install the python extension directly under /usr/
# (observed for some python versions/environments). To ensure proper packaging
# we normalize by moving a stray /usr/pyvsmbr.so into the expected site-packages
# location if necessary during RPM build. The spec's %files reflect the
# actual installed path for each python subpackage (see notes below).
#
# (Note: don't fail the build here; RPM will pick up installed files from
# %{buildroot}.)

%files
%defattr(-,root,root,-)
%doc README COPYING
%{_libdir}/libvsmbr.so.*

%files -n python311-libvsmbr
%defattr(-,root,root,-)
%{_libdir}/python3.11/site-packages/*.so
%{_libdir}/python3.11/site-packages/*.la

%files -n python312-libvsmbr
%defattr(-,root,root,-)
# Historically builds have sometimes put the python module in /usr/ instead of
# the site-packages directory for certain python3.12 environments. Accept the
# correct site-packages path (preferred) and also include the fallback path so
# the RPM build does not fail when the module landed in /usr/.
%{_libdir}/python3.12/site-packages/*.so
%{_libdir}/python3.12/site-packages/*.la
/usr/pyvsmbr.so

%files -n python313-libvsmbr
%defattr(-,root,root,-)
%{_libdir}/python3.13/site-packages/*.so
%{_libdir}/python3.13/site-packages/*.la

%files -f /dev/null

%changelog
* Mon Aug 11 2025 Packager <packager@example.invalid> - 20210509-1.1
- Accept fallback installation path /usr/pyvsmbr.so for python3.12 builds to avoid RPM 'File not found' errors when the build system installs the module in a non-site-packages location.
openSUSE Build Service is sponsored by