commit ce3c88bf83a2fbc753f85bd82f30e1ef946bc8416d229f73d4ab485ff568f5fd Author: Dirk Mueller Date: Sun Oct 20 18:59:25 2024 +0000 - update to 1.5.4: * Fixed a runtime error in pysnmp. * Fixed a runtime error in pysnmp. * Fixed a few runtime errors. * Removed Python 3.8 support. * Added Python 3.13 support. * Renamed many items to meet PEP 8 requirements. Compatibility layer is added, but will be removed in the next release. * Fixed a bug that Windows version and user name were not correctly detected. - drop support-new-pyasn1.patch (upstream) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pysmi?expand=0&rev=28 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..fcc7b97 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + test + diff --git a/pysmi-0.3.4.tar.gz b/pysmi-0.3.4.tar.gz new file mode 100644 index 0000000..0109931 --- /dev/null +++ b/pysmi-0.3.4.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd15a15020aee8376cab5be264c26330824a8b8164ed0195bd402dd59e4e8f7c +size 93985 diff --git a/pysmi-1.5.0.tar.gz b/pysmi-1.5.0.tar.gz new file mode 100644 index 0000000..a1b9441 --- /dev/null +++ b/pysmi-1.5.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e42bcd3961de71d58186f7a7fa6adac133701ae74cd19e6376289d89593b0af2 +size 124064 diff --git a/pysmi-1.5.4.tar.gz b/pysmi-1.5.4.tar.gz new file mode 100644 index 0000000..a7a3493 --- /dev/null +++ b/pysmi-1.5.4.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cffc1d018325d1810ad4554589ad113575dd2ae071409feb1fe1e1f0b56cd236 +size 122568 diff --git a/python-pysmi.changes b/python-pysmi.changes new file mode 100644 index 0000000..5453f05 --- /dev/null +++ b/python-pysmi.changes @@ -0,0 +1,141 @@ +------------------------------------------------------------------- +Sun Oct 20 18:57:03 UTC 2024 - Dirk Müller + +- update to 1.5.4: + * Fixed a runtime error in pysnmp. + * Fixed a runtime error in pysnmp. + * Fixed a few runtime errors. + * Removed Python 3.8 support. + * Added Python 3.13 support. + * Renamed many items to meet PEP 8 requirements. + Compatibility layer is added, but will be removed in the + next release. + * Fixed a bug that Windows version and user name were not + correctly detected. +- drop support-new-pyasn1.patch (upstream) + +------------------------------------------------------------------- +Wed Oct 9 06:31:17 UTC 2024 - Steve Kowalik + +- Update to 1.5.0: + * Better formatting of texts in MIB documents. + * Reworked on reserved Python keywords handling. + * Fixed TEXTUAL-CONVENTION handling. + * Fixed DEFVAL handling. + * Added cyclic dependency detection. + * Other fixes and improvements for real-world MIBs. + * Implemented a better strict mode. + * Fixed old Python version support. + * Fixed mibdump crash. + * Fixed a JSON output bug. + * Updated MIB URLs. + * Migrated to new asn1 repo. + * Bumped minimal Python version to 3.7. + * Introduced Jinja2 templates for code generation. + * Introduced SNMP agent code hooks generation template. +- Switch to autosetup macros. +- Add patch support-new-pyasn1.patch: + * Support new pyasn1 changes. + +------------------------------------------------------------------- +Mon Feb 19 04:44:48 UTC 2024 - Steve Kowalik + +- Switch to pyproject macros. +- Use pytest for the testsuite. +- No more greedy globs in %files. + +------------------------------------------------------------------- +Wed Oct 6 07:40:43 UTC 2021 - Matej Cepl + +- Add multibuild to separate test phase from the build one. + +------------------------------------------------------------------- +Tue Oct 5 15:33:49 UTC 2021 - Stefan Schubert + +- Added BuildRequires: alts + +------------------------------------------------------------------- +Thu Sep 30 20:13:20 UTC 2021 - Stefan Schubert + +- Use libalternatives instead of update-alternatives. + +------------------------------------------------------------------- +Mon Oct 14 14:17:08 UTC 2019 - Matej Cepl + +- Replace %fdupes -s with plain %fdupes; hardlinks are better. + +------------------------------------------------------------------- +Mon May 6 13:46:05 UTC 2019 - pgajdos@suse.com + +- version update to 0.3.4 + - Rebased MIB importing code onto `importlib` because `imp` is long + deprecated + - Fixed Py file borrower to become functional + +------------------------------------------------------------------- +Thu Jan 10 08:34:25 UTC 2019 - mardnh@gmx.de + +- Update to version 0.3.3 + * Exit code indication of the command-line tools aligned with + sysexits.h to report more useful termination status + +- Update to version 0.3.2 + * Fixed compiler crash when building comments at a platform + which has broken users/groups databases + +------------------------------------------------------------------- +Tue Dec 4 12:52:52 UTC 2018 - Matej Cepl + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- +Fri Aug 11 16:35:14 UTC 2017 - tbechtold@suse.com + +- update to 0.3.1: + * INET-ADDRESS-MIB configured as pre-built at pysnmp codegen + * JSON codegen produces "nodetype" element for OBJECT-TYPE + * Fix to mibdump.py --destination-directory option + * Fix to pysnmp and JSON code generators to properly refer to MIB module + defining particular MIB object + * The @mib@ magic in reader's URL template made optional. If it is not present, + MIB module name is just appended to URL template + * Send User-Agent containing pysmi and Python versions as well as platform name. + * Fixed missing STATUS/DISPLAY-HINT/REFERENCE/etc fields generation at pysnmp + backend when running in the non-full-text mode + * Fixed broken `ordereddict` dependency on Python 2.6- + * Generate REFERENCE and STATUS fields at various SMI objects + * Generate DESCRIPTION field followed REVISION field at MODULE-IDENTITY objects + * Generate PRODUCT-RELEASE field at AGENT-CAPABILITIES objects + * Generated Python source aligned with PEP8 + * MIB texts cleaned up by default, --keep-texts-layout preserves original formatting + * Fix to the `ordereddict` conditional dependency + * Missing test module recovered + * Failing tests fixed + * JSON code generating backend implemented + * Experimental JSON OID->MIB indices generation implemented + * Package structure flattened for easier use + * Minor refactoring to the test suite + * Source code statically analyzed, hardened and PEP8-ized + * Files closed explicitly to mute ResourceWarnings + * Fixed to Python 2.4 (and aged ply) compatibility + * Added a workaround to avoid generating pysnmp TextualConvention classes + inheriting from TextualConvention (when MIB defines a TEXTUAL-CONVENTION + based on another TEXTUAL-CONVENTION as SYNTAX) + * Author's e-mail changed, copyright extended to year 2017 +- convert to singlespec + +------------------------------------------------------------------- +Mon Aug 1 20:59:32 UTC 2016 - mardnh@gmx.de + +- Update to version 0.0.07 + * Crash on existing .py file handling fixed. + * Fix to __doc__ use in setup.py to make -O0 installation mode working. + * Fix to PyPackageSearcher not to fail on broken Python packages. + * Source code pep8'ed + * Copyright added to source files. + +------------------------------------------------------------------- +Sat Nov 21 15:33:19 UTC 2015 - bwiedemann@suse.com + +- initial package of version 0.0.6 + diff --git a/python-pysmi.spec b/python-pysmi.spec new file mode 100644 index 0000000..ed7528c --- /dev/null +++ b/python-pysmi.spec @@ -0,0 +1,110 @@ +# +# spec file for package python-pysmi +# +# Copyright (c) 2024 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 https://bugs.opensuse.org/ +# + + +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif + +%global flavor @BUILD_FLAVOR@%{nil} +%if "%{flavor}" == "test" +%define psuffix -test +%bcond_without test +%else +%define psuffix %{nil} +%bcond_with test +%endif +Name: python-pysmi%{psuffix} +Version: 1.5.4 +Release: 0 +Summary: SNMP SMI/MIB Parser +License: BSD-2-Clause +URL: https://github.com/lextudio/pysmi +Source: https://files.pythonhosted.org/packages/source/p/pysmi/pysmi-%{version}.tar.gz +BuildRequires: %{python_module base >= 3.8} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module poetry-core} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +%if %{with test} +BuildRequires: %{python_module Jinja2 >= 3.1} +BuildRequires: %{python_module ply >= 3.11} +BuildRequires: %{python_module pyasn1} +BuildRequires: %{python_module pysmi = %{version}} +BuildRequires: %{python_module pysnmp} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module requests >= 2.26} +%endif +Requires: python-Jinja2 >= 3.1 +Requires: python-ply >= 3.11 +Requires: python-requests >= 2.26 +%if %{with libalternatives} +BuildRequires: alts +Requires: alts +%else +Requires(post): update-alternatives +Requires(postun): update-alternatives +%endif +BuildArch: noarch +%python_subpackages + +%description +A pure-Python implementation of SNMP/SMI MIB parsing and conversion library. +Can produce PySNMP MIB modules. + +%prep +%autosetup -p1 -n pysmi-%{version} + +%build +%pyproject_wheel + +%install +%if !%{with test} +%pyproject_install +%python_clone -a %{buildroot}%{_bindir}/mibdump +%python_clone -a %{buildroot}%{_bindir}/mibcopy +%python_expand %fdupes %{buildroot}%{$python_sitelib} +%endif + +%check +%if %{with test} +%pytest +%endif + +%if !%{with test} +%pre +# If libalternatives is used: Removing old update-alternatives entries. +%python_libalternatives_reset_alternative mibdump + +%post +%python_install_alternative mibdump + +%postun +%python_uninstall_alternative mibdump + +%files %{python_files} +%license LICENSE.rst +%doc README.md examples/* +%{python_sitelib}/pysmi +%{python_sitelib}/pysmi-%{version}.dist-info +%python_alternative %{_bindir}/mibdump +%python_alternative %{_bindir}/mibcopy +%endif + +%changelog diff --git a/support-new-pyasn1.patch b/support-new-pyasn1.patch new file mode 100644 index 0000000..9656f14 --- /dev/null +++ b/support-new-pyasn1.patch @@ -0,0 +1,69 @@ +From 01d0774948da432f39c5a89622d676e91b8c47af Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +Date: Wed, 9 Oct 2024 17:20:45 +1100 +Subject: [PATCH] Remove use of str2octs from pyasn1 + +pyasn1 has been removing all Python 2 code from its codebase, and the +octets module has been removed from 0.6.1 onwards. Since we only support +Python 3.8, we can remove it and just encode to bytes. +--- + tests/test_objecttype_smiv2_pysnmp.py | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/tests/test_objecttype_smiv2_pysnmp.py b/tests/test_objecttype_smiv2_pysnmp.py +index fdec37e..b374332 100644 +--- a/tests/test_objecttype_smiv2_pysnmp.py ++++ b/tests/test_objecttype_smiv2_pysnmp.py +@@ -13,7 +13,6 @@ + except ImportError: + import unittest + +-from pyasn1.compat.octets import str2octs + from pysmi.parser.smi import parserFactory + from pysmi.codegen.pysnmp import PySnmpCodeGen + from pysmi.codegen.symtable import SymtableCodeGen +@@ -75,7 +74,7 @@ def testObjectTypeStatus(self): + # TODO:revisit + # def testObjectTypeReference(self): + # self.assertEqual( +- # self.ctx['testObjectType'].getReference(), str2octs('ABC'), ++ # self.ctx['testObjectType'].getReference(), 'ABC'.encode('iso-8859-1'), + # 'bad REFERENCE' + # ) + +@@ -335,7 +334,7 @@ def setUp(self): + # TODO: pyasn1 does not like OctetString.defaultValue + def testObjectTypeSyntax(self): + self.assertEqual( +- self.ctx["testObjectType"].getSyntax(), str2octs("test value"), "bad DEFVAL" ++ self.ctx["testObjectType"].getSyntax(), "test value".encode('iso-8859-1'), "bad DEFVAL" + ) + + +@@ -374,7 +373,7 @@ def setUp(self): + def testObjectTypeSyntax(self): + self.assertEqual( + self.ctx["testObjectType"].getSyntax(), +- str2octs("\\ntest\nvalue\\"), ++ "\\ntest\nvalue\\".encode('iso-8859-1'), + "bad DEFVAL", + ) + +@@ -488,7 +487,7 @@ def setUp(self): + def testObjectTypeSyntax(self): + self.assertEqual( + self.ctx["testObjectType"].getSyntax().clone(""), +- str2octs(""), ++ "".encode('iso-8859-1'), + "bad size constrained SYNTAX", + ) + +@@ -526,7 +525,7 @@ def setUp(self): + def testObjectTypeSyntax(self): + self.assertEqual( + self.ctx["testObjectType"].getSyntax().clone(("set",)), +- str2octs("@"), ++ "@".encode('iso-8859-1'), + "bad BITS SYNTAX", + ) +