forked from pool/python-dmidecode
- Synchronize SPEC file to be more like the SLE one.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-dmidecode?expand=0&rev=15
This commit is contained in:
@@ -22,13 +22,18 @@ Name: python-dmidecode
|
||||
Version: 3.12.2+git.1625035095.f0a089a
|
||||
Release: 0
|
||||
Summary: Python module to access DMI data
|
||||
Group: System/Management
|
||||
License: GPL-2.0-only
|
||||
Group: System/Libraries
|
||||
URL: https://github.com/nima/python-dmidecode
|
||||
# Source0: https://github.com/nima/python-dmidecode/archive/refs/tags/v%%{version}.tar.gz#/python-dmidecode-%%{version}.tar.gz
|
||||
Source0: python-dmidecode-%{version}.tar.gz
|
||||
# use DWORD instead of WORD when calling dmi_memory_device_extended_size
|
||||
Patch0: huge-memory.patch
|
||||
# PATCH-FIX-UPSTREAM gcc7-inline.patch gh#nima/python-dmidecode#35 mcepl@suse.com
|
||||
# Don't use inline keyword.
|
||||
Patch1: gcc7-inline.patch
|
||||
# PATCH-FIX-UPSTREAM detect-lib-with-py3.patch gh#nima/python-dmidecode#36 mcepl@suse.com
|
||||
# Make the code future-proof against removal of distutils module.
|
||||
Patch2: detect-lib-with-py3.patch
|
||||
# PATCH-FIX-UPSTREAM 31-version_info-v-version.patch gh#nima/python-dmidecode#31 mcepl@suse.com
|
||||
# use sys.version_info instead of sys.version
|
||||
@@ -36,15 +41,16 @@ Patch3: 31-version_info-v-version.patch
|
||||
Obsoletes: %{oldpython}-dmidecode <= 3.12.2+git.1625035095.f0a089a
|
||||
Obsoletes: python-python-dmidecode <= 3.12.2+git.1625035095.f0a089a
|
||||
BuildRequires: %{python_module devel}
|
||||
%if 0%{?sle_version} && 0%{?sle_version} < 150400
|
||||
%if 0%{?sle_version} >= 150400 || 0%{?suse_version} >= 1550
|
||||
BuildRequires: %{python_module libxml2}
|
||||
%else
|
||||
BuildRequires: python2-libxml2-python
|
||||
BuildRequires: python3-libxml2-python
|
||||
%else
|
||||
BuildRequires: %{python_module libxml2}
|
||||
%endif
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: libxml2-devel
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun):update-alternatives
|
||||
%python_subpackages
|
||||
@@ -57,8 +63,6 @@ structures or as XML data using libxml2.
|
||||
%prep
|
||||
%autosetup -p1
|
||||
|
||||
sed -i 's/python2/python3/g' Makefile unit-tests/Makefile
|
||||
|
||||
%build
|
||||
%{python_expand export LDFLAGS="-Wl,-rpath=%{$python_sitearch}"
|
||||
%make_build PY_BIN=$python build
|
||||
@@ -67,31 +71,35 @@ sed -i 's/python2/python3/g' Makefile unit-tests/Makefile
|
||||
%install
|
||||
%{python_expand rm -f %{buildroot}%{_datadir}/python-dmidecode/pymap.xml
|
||||
$python src/setup.py install --root %{buildroot} --prefix=%{_prefix}
|
||||
ls -l %{buildroot}%{_datadir}/python-dmidecode/
|
||||
|
||||
# prepare alternatives
|
||||
install -d %{buildroot}%{_sysconfdir}/alternatives
|
||||
mv %{buildroot}%{_datadir}/python-dmidecode/pymap{,-%{$python_bin_suffix}}.xml
|
||||
touch %{buildroot}%{_datadir}/python-dmidecode/pymap.xml
|
||||
touch %{buildroot}%{_sysconfdir}/alternatives/pymap.xml
|
||||
ln -s %{_sysconfdir}/alternatives/pymap.xml \
|
||||
%{buildroot}%{_datadir}/python-dmidecode/pymap.xml
|
||||
%fdupes %{buildroot}%{$python_sitearch}
|
||||
}
|
||||
|
||||
%check
|
||||
pushd unit-tests
|
||||
%python_expand PYTHON=$python %make_build
|
||||
%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch}
|
||||
make PY_BIN=$python
|
||||
}
|
||||
popd
|
||||
|
||||
%post
|
||||
PRIO=$(echo %{python_version}|tr -d '.')
|
||||
/usr/sbin/update-alternatives --install %{_datadir}/python-dmidecode/pymap.xml pymap.xml \
|
||||
%{_sbindir}/update-alternatives --install %{_datadir}/python-dmidecode/pymap.xml pymap.xml \
|
||||
%{_datadir}/python-dmidecode/pymap-%{python_bin_suffix}.xml ${PRIO}
|
||||
|
||||
%postun
|
||||
if [ ! -f %{_datadir}/python-dmidecode/pymap-%{python_bin_suffix}.xml ] ; then
|
||||
MAJVER=$(ver=%{python_version}; echo ${ver:0:1})
|
||||
/usr/sbin/update-alternatives --remove pymap.xml \
|
||||
%{_sbindir}/update-alternatives --remove pymap.xml \
|
||||
%{_datadir}/python-dmidecode/pymap-%{python_bin_suffix}.xml
|
||||
fi
|
||||
|
||||
%clean
|
||||
|
||||
%files %{python_files}
|
||||
%license doc/LICENSE
|
||||
%doc README doc/README.upstream doc/AUTHORS doc/AUTHORS.upstream
|
||||
@@ -99,8 +107,9 @@ fi
|
||||
%ghost %{_sysconfdir}/alternatives/pymap.xml
|
||||
%ghost %{_datadir}/python-dmidecode/pymap.xml
|
||||
%{_datadir}/python-dmidecode/pymap-%{python_bin_suffix}.xml
|
||||
# %{python_sitearch}/python_dmidecode-%{version}*-info
|
||||
%{python_sitearch}/python_dmidecode-3.12.2*-info
|
||||
%{python_sitearch}/dmidecode*
|
||||
%{python_sitearch}/*.egg-info
|
||||
%pycache_only %{python_sitearch}/__pycache__/*
|
||||
%pycache_only %{python_sitearch}/__pycache__/dmidecode*.py[co]
|
||||
|
||||
%changelog
|
||||
|
||||
Reference in New Issue
Block a user