File python-pysnmp-apps.spec of Package python-pysnmp-apps
#
# spec file for package python-pysnmp-apps
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define modname pysnmp-apps
%bcond_without python2
Name: python-%{modname}
Version: 0.5.3
Release: 1
License: BSD-2-Clause
Summary: PySNMP Applications
Url: http://pysnmp.sourceforge.net/
Group: Development/Libraries/Python
Source: http://pypi.python.org/packages/source/p/pysnmp-apps/%{modname}-%{version}.tar.gz
BuildRequires: %{python_module pysnmp}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-pysnmp
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
%python_subpackages
%description
A set of SNMP applications written on top of python-pysnmp. Some of these tools
mimic their famous Net-SNMP (http://sourceforge.net/projects/net-snmp/)
counterparts, while others are designed toward easy integration with other
Python applications.
%prep
%setup -q -n %{modname}-%{version}
%build
%python_build
%install
%{python_expand %$python_install
# Prepare for update-alternatives usage
for p in snmpget.py snmpset.py snmpwalk.py snmpbulkwalk.py snmptrap.py snmptranslate.py; do
sed -i "s|#!%{_bindir}/env python|#!%__$python|" %{buildroot}/%{_bindir}/$p
mv %{buildroot}%{_bindir}/$p %{buildroot}%{_bindir}/$p-%{$python_bin_suffix}
done
}
for p in snmpget.py snmpset.py snmpwalk.py snmpbulkwalk.py snmptrap.py snmptranslate.py; do
%prepare_alternative $p
done
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%post
%python_install_alternative snmpget.py snmpset.py snmpwalk.py snmpbulkwalk.py snmptrap.py snmptranslate.py
%postun
%python_uninstall_alternative snmpget.py
%files %{python_files}
%defattr(-,root,root)
%license LICENSE.txt
%doc CHANGES.txt README.md
%python_alternative %{_bindir}/snmpget.py
%python_alternative %{_bindir}/snmpset.py
%python_alternative %{_bindir}/snmpwalk.py
%python_alternative %{_bindir}/snmpbulkwalk.py
%python_alternative %{_bindir}/snmptrap.py
%python_alternative %{_bindir}/snmptranslate.py
%{python_sitelib}/pysnmp_apps
%{python_sitelib}/pysnmp_apps-%{version}-py*.egg-info
%changelog