Got a runtime error so py files are installed instead of pyc

Traceback (most recent call last):
  File "/usr/bin/snmptrap.py", line 237, in <module>
  snmpEngine = engine.SnmpEngine()
  File "/usr/lib/python3.7/site-packages/pysnmp/entity/engine.py", line 63, in 
__init__
  File "/usr/lib/python3.7/site-packages/pysnmp/proto/rfc3412.py", line 32, in 
__init__
  File "/usr/lib/python3.7/site-packages/pysnmp/smi/builder.py", line 401, in 
loadModules
  File "/usr/lib/python3.7/site-packages/pysnmp/smi/builder.py", line 341, in 
loadModule
  File "/usr/lib/python3.7/site-packages/pysnmp/smi/builder.py", line 143, in 
read
  ValueError: bad marshal data (unknown type code)

Signed-off-by: Lars Pedersen <[email protected]>
---
 rules/python3-pysnmp.in   | 13 +++++++++
 rules/python3-pysnmp.make | 55 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 rules/python3-pysnmp.in
 create mode 100644 rules/python3-pysnmp.make

diff --git a/rules/python3-pysnmp.in b/rules/python3-pysnmp.in
new file mode 100644
index 000000000..09e9b2b0a
--- /dev/null
+++ b/rules/python3-pysnmp.in
@@ -0,0 +1,13 @@
+## SECTION=python3
+
+config PYTHON3_PYSNMP
+       bool
+       prompt "pysnmp"
+       select PYTHON3
+       select HOST_PYTHON3_SETUPTOOLS
+       select PYTHON3_PLY
+       select PYTHON3_PYASN1
+       select PYTHON3_PYCRYPTODOMEX
+       select PYTHON3_PYSMI
+       help
+         pySNMP is a cross-platform, pure-Python SNMP engine implementation.
diff --git a/rules/python3-pysnmp.make b/rules/python3-pysnmp.make
new file mode 100644
index 000000000..cb08668b3
--- /dev/null
+++ b/rules/python3-pysnmp.make
@@ -0,0 +1,55 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2021 by Lars Pedersen <[email protected]>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_PYTHON3_PYSNMP) += python3-pysnmp
+
+#
+# Paths and names
+#
+PYTHON3_PYSNMP_VERSION := 4.4.12
+PYTHON3_PYSNMP_MD5     := 2222880259daf6e2cb322e938c818276
+PYTHON3_PYSNMP         := pysnmp-$(PYTHON3_PYSNMP_VERSION)
+PYTHON3_PYSNMP_SUFFIX  := tar.gz
+PYTHON3_PYSNMP_URL     := $(call ptx/mirror-pypi, pysnmp, 
$(PYTHON3_PYSNMP).$(PYTHON3_PYSNMP_SUFFIX))
+PYTHON3_PYSNMP_SOURCE  := $(SRCDIR)/$(PYTHON3_PYSNMP).$(PYTHON3_PYSNMP_SUFFIX)
+PYTHON3_PYSNMP_DIR     := $(BUILDDIR)/$(PYTHON3_PYSNMP)
+PYTHON3_PYSNMP_LICENSE := BSD-2-Clause
+PYTHON3_PYSNMP_LICENSE_FILES := \
+       file://LICENSE.rst;md5=b15d29f500f748d1c2a15709769090a8
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+PYTHON3_PYSNMP_CONF_TOOL       := python3
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/python3-pysnmp.targetinstall:
+       @$(call targetinfo)
+
+       @$(call install_init, python3-pysnmp)
+       @$(call install_fixup, python3-pysnmp,PRIORITY,optional)
+       @$(call install_fixup, python3-pysnmp,SECTION,base)
+       @$(call install_fixup, python3-pysnmp,AUTHOR,"Lars Pedersen 
<[email protected]>")
+       @$(call install_fixup, python3-pysnmp,DESCRIPTION,missing)
+
+       # Install py files instead of pyc because of runtime marshal error
+       @$(call install_glob,python3-pysnmp, 0, 0, -, \
+               /usr/lib/python$(PYTHON3_MAJORMINOR)/site-packages,, *.pyc)
+
+       @$(call install_finish, python3-pysnmp)
+
+       @$(call touch)
+
+# vim: syntax=make
-- 
2.31.1


_______________________________________________
ptxdist mailing list
[email protected]
To unsubscribe, send a mail with subject "unsubscribe" to 
[email protected]

Reply via email to