Python3 support draft
This commit is contained in:
parent
4a9c0ab606
commit
9e592fe1d9
@ -1,6 +1,6 @@
|
||||
diff -urNp old/configure new/configure
|
||||
--- old/configure 2018-02-27 09:13:39.865414853 +0100
|
||||
+++ new/configure 2018-02-27 09:25:30.341067359 +0100
|
||||
diff -urNp net-snmp-5.7.3/configure pnew/configure
|
||||
--- net-snmp-5.7.3/configure 2018-05-09 13:53:32.757997551 +0200
|
||||
+++ pnew/configure 2018-05-02 12:09:38.592944958 +0200
|
||||
@@ -6412,8 +6412,8 @@ $as_echo "no" >&6; }
|
||||
fi
|
||||
|
||||
@ -12,9 +12,21 @@ diff -urNp old/configure new/configure
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||
$as_echo_n "checking for $ac_word... " >&6; }
|
||||
if ${ac_cv_path_PYTHONPROG+:} false; then :
|
||||
diff -urNp old/Makefile.in new/Makefile.in
|
||||
--- old/Makefile.in 2018-02-27 09:13:39.863414712 +0100
|
||||
+++ new/Makefile.in 2018-02-27 12:14:02.428730316 +0100
|
||||
diff -urNp net-snmp-5.7.3/configure.d/config_os_progs pnew/configure.d/config_os_progs
|
||||
--- net-snmp-5.7.3/configure.d/config_os_progs 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ pnew/configure.d/config_os_progs 2018-05-02 11:54:39.816551980 +0200
|
||||
@@ -57,7 +57,7 @@ AC_PATH_PROG(AUTOCONF, autoconf)
|
||||
AC_PATH_PROG(AUTOHEADER, autoheader)
|
||||
AC_PATH_PROG([PERLPROG], perl)
|
||||
AC_PATH_PROG([PSPROG], ps)
|
||||
-AC_PATH_PROG([PYTHONPROG],python)
|
||||
+AC_PATH_PROG([PYTHONPROG],python3)
|
||||
|
||||
AC_PATH_PROG([UNAMEPROG], uname)
|
||||
AC_DEFINE_UNQUOTED(UNAMEPROG,"$UNAMEPROG", [Where is the uname command])
|
||||
diff -urNp net-snmp-5.7.3/Makefile.in pnew/Makefile.in
|
||||
--- net-snmp-5.7.3/Makefile.in 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ pnew/Makefile.in 2018-05-02 10:12:12.496567598 +0200
|
||||
@@ -222,7 +222,7 @@ perlcleanfeatures:
|
||||
|
||||
# python specific build rules
|
||||
@ -24,9 +36,102 @@ diff -urNp old/Makefile.in new/Makefile.in
|
||||
pythonmodules: subdirs
|
||||
@(dir=`pwd`; cd python; $(PYMAKE) build --basedir=$$dir) ; \
|
||||
if test $$? != 0 ; then \
|
||||
diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
--- old/python/netsnmp/tests/test.py 2018-02-27 09:13:39.904417605 +0100
|
||||
+++ new/python/netsnmp/tests/test.py 2018-02-27 10:37:43.488435738 +0100
|
||||
diff -urNp net-snmp-5.7.3/python/netsnmp/client_intf.c pnew/python/netsnmp/client_intf.c
|
||||
--- net-snmp-5.7.3/python/netsnmp/client_intf.c 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ pnew/python/netsnmp/client_intf.c 2018-05-02 11:19:54.447257954 +0200
|
||||
@@ -979,7 +979,7 @@ py_netsnmp_attr_string(PyObject *obj, ch
|
||||
PyObject *attr = PyObject_GetAttrString(obj, attr_name);
|
||||
if (attr) {
|
||||
int retval;
|
||||
- retval = PyString_AsStringAndSize(attr, val, len);
|
||||
+ retval = PyBytes_AsStringAndSize(attr, val, len);
|
||||
Py_DECREF(attr);
|
||||
return retval;
|
||||
}
|
||||
@@ -996,7 +996,7 @@ py_netsnmp_attr_long(PyObject *obj, char
|
||||
if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) {
|
||||
PyObject *attr = PyObject_GetAttrString(obj, attr_name);
|
||||
if (attr) {
|
||||
- val = PyInt_AsLong(attr);
|
||||
+ val = PyLong_AsLong(attr);
|
||||
Py_DECREF(attr);
|
||||
}
|
||||
}
|
||||
@@ -1079,11 +1079,11 @@ __py_netsnmp_update_session_errors(PyObj
|
||||
|
||||
py_netsnmp_attr_set_string(session, "ErrorStr", err_str, STRLEN(err_str));
|
||||
|
||||
- tmp_for_conversion = PyInt_FromLong(err_num);
|
||||
+ tmp_for_conversion = PyLong_FromLong(err_num);
|
||||
PyObject_SetAttrString(session, "ErrorNum", tmp_for_conversion);
|
||||
Py_DECREF(tmp_for_conversion);
|
||||
|
||||
- tmp_for_conversion = PyInt_FromLong(err_ind);
|
||||
+ tmp_for_conversion = PyLong_FromLong(err_ind);
|
||||
PyObject_SetAttrString(session, "ErrorInd", tmp_for_conversion);
|
||||
Py_DECREF(tmp_for_conversion);
|
||||
}
|
||||
@@ -2607,10 +2607,22 @@ static PyMethodDef ClientMethods[] = {
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
+static struct PyModuleDef ModuleDefinition = {
|
||||
+ PyModuleDef_HEAD_INIT,
|
||||
+ "client_intf",
|
||||
+ NULL,
|
||||
+ -1,
|
||||
+ ClientMethods,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ NULL
|
||||
+};
|
||||
+
|
||||
PyMODINIT_FUNC
|
||||
initclient_intf(void)
|
||||
{
|
||||
- (void) Py_InitModule("client_intf", ClientMethods);
|
||||
+ PyModule_Create(&ModuleDefinition);
|
||||
}
|
||||
|
||||
|
||||
diff -urNp net-snmp-5.7.3/python/netsnmp/client.py pnew/python/netsnmp/client.py
|
||||
--- net-snmp-5.7.3/python/netsnmp/client.py 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ pnew/python/netsnmp/client.py 2018-05-02 13:06:08.609571674 +0200
|
||||
@@ -35,12 +35,12 @@ def _parse_session_args(kargs):
|
||||
'TheirHostname':'',
|
||||
'TrustCert':''
|
||||
}
|
||||
- keys = kargs.keys()
|
||||
+ keys = list(kargs.keys())
|
||||
for key in keys:
|
||||
- if sessArgs.has_key(key):
|
||||
+ if key in sessArgs:
|
||||
sessArgs[key] = kargs[key]
|
||||
else:
|
||||
- print >>stderr, "ERROR: unknown key", key
|
||||
+ print("ERROR: unknown key", key, file=stderr)
|
||||
return sessArgs
|
||||
|
||||
def STR(obj):
|
||||
@@ -127,7 +127,7 @@ class Session(object):
|
||||
|
||||
sess_args = _parse_session_args(args)
|
||||
|
||||
- for k,v in sess_args.items():
|
||||
+ for k,v in list(sess_args.items()):
|
||||
self.__dict__[k] = v
|
||||
|
||||
|
||||
diff -urNp net-snmp-5.7.3/python/netsnmp/__init__.py pnew/python/netsnmp/__init__.py
|
||||
--- net-snmp-5.7.3/python/netsnmp/__init__.py 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ pnew/python/netsnmp/__init__.py 2018-05-09 13:47:17.708229826 +0200
|
||||
@@ -1 +1 @@
|
||||
-from client import *
|
||||
+from .client import *
|
||||
diff -urNp net-snmp-5.7.3/python/netsnmp/tests/test.py pnew/python/netsnmp/tests/test.py
|
||||
--- net-snmp-5.7.3/python/netsnmp/tests/test.py 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ pnew/python/netsnmp/tests/test.py 2018-05-09 13:47:57.132106532 +0200
|
||||
@@ -8,7 +8,7 @@ import time
|
||||
|
||||
class BasicTests(unittest.TestCase):
|
||||
@ -48,10 +153,10 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
Community='public')
|
||||
|
||||
- print "v1 snmpget result: ", res, "\n"
|
||||
+ print ("v1 snmpget result: ", res, "\n")
|
||||
+ print(("v1 snmpget result: ", res, "\n"))
|
||||
|
||||
- print "v1 get var: ", var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print ("v1 get var: ", var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print(("v1 get var: ", var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
- print "---v1 GETNEXT tests-------------------------------------\n"
|
||||
+ print ("---v1 GETNEXT tests-------------------------------------\n")
|
||||
@ -61,10 +166,10 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
Community='public')
|
||||
|
||||
- print "v1 snmpgetnext result: ", res, "\n"
|
||||
+ print ("v1 snmpgetnext result: ", res, "\n")
|
||||
+ print(("v1 snmpgetnext result: ", res, "\n"))
|
||||
|
||||
- print "v1 getnext var: ", var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print ("v1 getnext var: ", var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print(("v1 getnext var: ", var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
- print "---v1 SET tests-------------------------------------\n"
|
||||
+ print ("---v1 SET tests-------------------------------------\n")
|
||||
@ -75,10 +180,10 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
Community='public')
|
||||
|
||||
- print "v1 snmpset result: ", res, "\n"
|
||||
+ print ("v1 snmpset result: ", res, "\n")
|
||||
+ print(("v1 snmpset result: ", res, "\n"))
|
||||
|
||||
- print "v1 set var: ", var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print ("v1 set var: ", var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print(("v1 set var: ", var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
- print "---v1 walk tests-------------------------------------\n"
|
||||
+ print ("---v1 walk tests-------------------------------------\n")
|
||||
@ -88,18 +193,18 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
+ print ("v1 varlist walk in: ")
|
||||
for var in vars:
|
||||
- print " ",var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print (" ",var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((" ",var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
res = netsnmp.snmpwalk(vars,
|
||||
Version = 1,
|
||||
DestHost='localhost',
|
||||
Community='public')
|
||||
- print "v1 snmpwalk result: ", res, "\n"
|
||||
+ print ("v1 snmpwalk result: ", res, "\n")
|
||||
+ print(("v1 snmpwalk result: ", res, "\n"))
|
||||
|
||||
for var in vars:
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
|
||||
- print "---v1 walk 2-------------------------------------\n"
|
||||
@ -113,10 +218,10 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
DestHost='localhost',
|
||||
Community='public')
|
||||
- print "v1 snmpwalk result (should be = orig): ", res, "\n"
|
||||
+ print ("v1 snmpwalk result (should be = orig): ", res, "\n")
|
||||
+ print(("v1 snmpwalk result (should be = orig): ", res, "\n"))
|
||||
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
- print "---v1 multi-varbind test-------------------------------------\n"
|
||||
+ print ("---v1 multi-varbind test-------------------------------------\n")
|
||||
@ -128,19 +233,19 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
netsnmp.Varbind('sysLocation', 0))
|
||||
vals = sess.get(vars)
|
||||
- print "v1 sess.get result: ", vals, "\n"
|
||||
+ print ("v1 sess.get result: ", vals, "\n")
|
||||
+ print(("v1 sess.get result: ", vals, "\n"))
|
||||
|
||||
for var in vars:
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
vals = sess.getnext(vars)
|
||||
- print "v1 sess.getnext result: ", vals, "\n"
|
||||
+ print ("v1 sess.getnext result: ", vals, "\n")
|
||||
+ print(("v1 sess.getnext result: ", vals, "\n"))
|
||||
|
||||
for var in vars:
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
vars = netsnmp.VarList(netsnmp.Varbind('sysUpTime'),
|
||||
netsnmp.Varbind('sysORLastChange'),
|
||||
@ -149,11 +254,11 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
|
||||
vals = sess.getbulk(2, 8, vars)
|
||||
- print "v1 sess.getbulk result: ", vals, "\n"
|
||||
+ print ("v1 sess.getbulk result: ", vals, "\n")
|
||||
+ print(("v1 sess.getbulk result: ", vals, "\n"))
|
||||
|
||||
for var in vars:
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
- print "---v1 set2-------------------------------------\n"
|
||||
+ print ("---v1 set2-------------------------------------\n")
|
||||
@ -162,7 +267,7 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
netsnmp.Varbind('sysLocation', '0', 'my newer location'))
|
||||
res = sess.set(vars)
|
||||
- print "v1 sess.set result: ", res, "\n"
|
||||
+ print ("v1 sess.set result: ", res, "\n")
|
||||
+ print(("v1 sess.set result: ", res, "\n"))
|
||||
|
||||
- print "---v1 walk3-------------------------------------\n"
|
||||
+ print ("---v1 walk3-------------------------------------\n")
|
||||
@ -170,11 +275,11 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
|
||||
vals = sess.walk(vars)
|
||||
- print "v1 sess.walk result: ", vals, "\n"
|
||||
+ print ("v1 sess.walk result: ", vals, "\n")
|
||||
+ print(("v1 sess.walk result: ", vals, "\n"))
|
||||
|
||||
for var in vars:
|
||||
- print " ",var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print (" ",var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((" ",var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
- print "---v2c get-------------------------------------\n"
|
||||
+ print ("---v2c get-------------------------------------\n")
|
||||
@ -186,7 +291,7 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
netsnmp.Varbind('sysLocation', 0))
|
||||
vals = sess.get(vars)
|
||||
- print "v2 sess.get result: ", vals, "\n"
|
||||
+ print ("v2 sess.get result: ", vals, "\n")
|
||||
+ print(("v2 sess.get result: ", vals, "\n"))
|
||||
|
||||
- print "---v2c getnext-------------------------------------\n"
|
||||
+ print ("---v2c getnext-------------------------------------\n")
|
||||
@ -194,17 +299,17 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
for var in vars:
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
- print "\n"
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
+ print ("\n")
|
||||
|
||||
vals = sess.getnext(vars)
|
||||
- print "v2 sess.getnext result: ", vals, "\n"
|
||||
+ print ("v2 sess.getnext result: ", vals, "\n")
|
||||
+ print(("v2 sess.getnext result: ", vals, "\n"))
|
||||
|
||||
for var in vars:
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
- print "\n"
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
+ print ("\n")
|
||||
|
||||
- print "---v2c getbulk-------------------------------------\n"
|
||||
@ -217,12 +322,12 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
|
||||
vals = sess.getbulk(2, 8, vars)
|
||||
- print "v2 sess.getbulk result: ", vals, "\n"
|
||||
+ print ("v2 sess.getbulk result: ", vals, "\n")
|
||||
+ print(("v2 sess.getbulk result: ", vals, "\n"))
|
||||
|
||||
for var in vars:
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
- print "\n"
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
+ print ("\n")
|
||||
|
||||
- print "---v2c set-------------------------------------\n"
|
||||
@ -233,7 +338,7 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
|
||||
res = sess.set(vars)
|
||||
- print "v2 sess.set result: ", res, "\n"
|
||||
+ print ("v2 sess.set result: ", res, "\n")
|
||||
+ print(("v2 sess.set result: ", res, "\n"))
|
||||
|
||||
- print "---v2c walk-------------------------------------\n"
|
||||
+ print ("---v2c walk-------------------------------------\n")
|
||||
@ -241,11 +346,11 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
|
||||
vals = sess.walk(vars)
|
||||
- print "v2 sess.walk result: ", vals, "\n"
|
||||
+ print ("v2 sess.walk result: ", vals, "\n")
|
||||
+ print(("v2 sess.walk result: ", vals, "\n"))
|
||||
|
||||
for var in vars:
|
||||
- print " ",var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print (" ",var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((" ",var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
- print "---v3 setup-------------------------------------\n"
|
||||
+ print ("---v3 setup-------------------------------------\n")
|
||||
@ -260,12 +365,12 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
+ print ("---v3 get-------------------------------------\n")
|
||||
vals = sess.get(vars)
|
||||
- print "v3 sess.get result: ", vals, "\n"
|
||||
+ print ("v3 sess.get result: ", vals, "\n")
|
||||
+ print(("v3 sess.get result: ", vals, "\n"))
|
||||
|
||||
for var in vars:
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
- print "\n"
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
+ print ("\n")
|
||||
|
||||
- print "---v3 getnext-------------------------------------\n"
|
||||
@ -273,12 +378,12 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
|
||||
vals = sess.getnext(vars)
|
||||
- print "v3 sess.getnext result: ", vals, "\n"
|
||||
+ print ("v3 sess.getnext result: ", vals, "\n")
|
||||
+ print(("v3 sess.getnext result: ", vals, "\n"))
|
||||
|
||||
for var in vars:
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
- print "\n"
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
+ print ("\n")
|
||||
|
||||
vars = netsnmp.VarList(netsnmp.Varbind('sysUpTime'),
|
||||
@ -288,12 +393,12 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
|
||||
vals = sess.getbulk(2, 8, vars)
|
||||
- print "v3 sess.getbulk result: ", vals, "\n"
|
||||
+ print ("v3 sess.getbulk result: ", vals, "\n")
|
||||
+ print(("v3 sess.getbulk result: ", vals, "\n"))
|
||||
|
||||
for var in vars:
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
- print "\n"
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
+ print ("\n")
|
||||
|
||||
- print "---v3 set-------------------------------------\n"
|
||||
@ -303,7 +408,7 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
netsnmp.Varbind('sysLocation','0', 'my final destination'))
|
||||
res = sess.set(vars)
|
||||
- print "v3 sess.set result: ", res, "\n"
|
||||
+ print ("v3 sess.set result: ", res, "\n")
|
||||
+ print(("v3 sess.set result: ", res, "\n"))
|
||||
|
||||
- print "---v3 walk-------------------------------------\n"
|
||||
+ print ("---v3 walk-------------------------------------\n")
|
||||
@ -311,11 +416,11 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
|
||||
vals = sess.walk(vars)
|
||||
- print "v3 sess.walk result: ", vals, "\n"
|
||||
+ print ("v3 sess.walk result: ", vals, "\n")
|
||||
+ print(("v3 sess.walk result: ", vals, "\n"))
|
||||
|
||||
for var in vars:
|
||||
- print " ",var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print (" ",var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((" ",var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
|
||||
class SetTests(unittest.TestCase):
|
||||
@ -327,7 +432,7 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
res = netsnmp.snmpget(var, Version = 1, DestHost='localhost',
|
||||
Community='public')
|
||||
- print "uptime = ", res[0]
|
||||
+ print ("uptime = ", res[0])
|
||||
+ print(("uptime = ", res[0]))
|
||||
|
||||
|
||||
var = netsnmp.Varbind('versionRestartAgent','0', 1)
|
||||
@ -336,13 +441,13 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
res = netsnmp.snmpget(var, Version = 1, DestHost='localhost',
|
||||
Community='public')
|
||||
- print "uptime = ", res[0]
|
||||
+ print ("uptime = ", res[0])
|
||||
+ print(("uptime = ", res[0]))
|
||||
|
||||
var = netsnmp.Varbind('nsCacheEntry')
|
||||
res = netsnmp.snmpgetnext(var, Version = 1, DestHost='localhost',
|
||||
Community='public')
|
||||
- print "var = ", var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print ("var = ", var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print(("var = ", var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
var.val = 65
|
||||
res = netsnmp.snmpset(var, Version = 1, DestHost='localhost',
|
||||
@ -350,7 +455,7 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
res = netsnmp.snmpget(var, Version = 1, DestHost='localhost',
|
||||
Community='public')
|
||||
- print "var = ", var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
+ print ("var = ", var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print(("var = ", var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
|
||||
sess = netsnmp.Session(Version = 1, DestHost='localhost',
|
||||
Community='public')
|
||||
@ -359,7 +464,7 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
res = sess.set(vars)
|
||||
|
||||
- print "res = ", res
|
||||
+ print ("res = ", res)
|
||||
+ print(("res = ", res))
|
||||
|
||||
vars = netsnmp.VarList(netsnmp.Varbind('snmpTargetAddrTDomain'),
|
||||
netsnmp.Varbind('snmpTargetAddrTAddress'),
|
||||
@ -369,7 +474,7 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
for var in vars:
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
- print "\n"
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
+ print ("\n")
|
||||
|
||||
vars = netsnmp.VarList(netsnmp.Varbind('.1.3.6.1.6.3.12.1.2.1.9.116.101.115.116','', 6))
|
||||
@ -377,7 +482,7 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
res = sess.set(vars)
|
||||
|
||||
- print "res = ", res
|
||||
+ print ("res = ", res)
|
||||
+ print(("res = ", res))
|
||||
|
||||
vars = netsnmp.VarList(netsnmp.Varbind('snmpTargetAddrTDomain'),
|
||||
netsnmp.Varbind('snmpTargetAddrTAddress'),
|
||||
@ -387,7 +492,7 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
for var in vars:
|
||||
- print var.tag, var.iid, "=", var.val, '(',var.type,')'
|
||||
- print "\n"
|
||||
+ print (var.tag, var.iid, "=", var.val, '(',var.type,')')
|
||||
+ print((var.tag, var.iid, "=", var.val, '(',var.type,')'))
|
||||
+ print ("\n")
|
||||
|
||||
- print "\n-------------- SET Test End ----------------------------\n"
|
||||
@ -395,9 +500,9 @@ diff -urNp old/python/netsnmp/tests/test.py new/python/netsnmp/tests/test.py
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
diff -urNp old/python/setup.py new/python/setup.py
|
||||
--- old/python/setup.py 2018-02-27 09:13:39.904417605 +0100
|
||||
+++ new/python/setup.py 2018-02-27 10:03:24.816969453 +0100
|
||||
diff -urNp net-snmp-5.7.3/python/setup.py pnew/python/setup.py
|
||||
--- net-snmp-5.7.3/python/setup.py 2014-12-08 21:23:22.000000000 +0100
|
||||
+++ pnew/python/setup.py 2018-05-02 10:12:12.499567600 +0200
|
||||
@@ -9,9 +9,9 @@ intree=0
|
||||
|
||||
args = sys.argv[:]
|
||||
|
@ -7,7 +7,7 @@
|
||||
Summary: A collection of SNMP protocol tools and libraries
|
||||
Name: net-snmp
|
||||
Version: 5.7.3
|
||||
Release: 38%{?dist}
|
||||
Release: 39%{?dist}
|
||||
Epoch: 1
|
||||
|
||||
License: BSD
|
||||
@ -70,7 +70,7 @@ Patch100: net-snmp-5.7.3-openssl.patch
|
||||
Patch101: net-snmp-5.7.3-modern-rpm-api.patch
|
||||
|
||||
#disable this patch due compatibility issues
|
||||
#Patch102: net-snmp-5.7.3-python3.patch
|
||||
Patch102: net-snmp-5.7.3-python3.patch
|
||||
|
||||
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
@ -84,8 +84,8 @@ BuildRequires: systemd
|
||||
BuildRequires: openssl-devel, bzip2-devel, elfutils-devel
|
||||
BuildRequires: libselinux-devel, elfutils-libelf-devel, rpm-devel
|
||||
BuildRequires: perl-devel, perl(ExtUtils::Embed), procps
|
||||
#BuildRequires: python3-devel, python3-setuptools
|
||||
BuildRequires: python2-devel, python2-setuptools
|
||||
BuildRequires: python3-devel, python3-setuptools
|
||||
#BuildRequires: python2-devel, python2-setuptools
|
||||
BuildRequires: chrpath
|
||||
BuildRequires: mariadb-connector-c-devel
|
||||
# for netstat, needed by 'make test'
|
||||
@ -186,22 +186,9 @@ Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
The net-snmp-agent-libs package contains the runtime agent libraries for shared
|
||||
binaries and applications.
|
||||
|
||||
%package -n python2-net-snmp
|
||||
%{?python_provide:%python_provide python2-net-snmp}
|
||||
# Remove before F30
|
||||
Provides: %{name}-python = %{version}-%{release}
|
||||
Provides: %{name}-python%{?_isa} = %{version}-%{release}
|
||||
Obsoletes: %{name}-python < %{version}-%{release}
|
||||
Summary: The Python 'netsnmp' module for the Net-SNMP
|
||||
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
|
||||
%description -n python2-net-snmp
|
||||
The 'netsnmp' module provides a full featured, tri-lingual SNMP (SNMPv3,
|
||||
SNMPv2c, SNMPv1) client API. The 'netsnmp' module internals rely on the
|
||||
Net-SNMP toolkit library.
|
||||
|
||||
#%package -n python3-net-snmp
|
||||
#%%{?python_provide:%%python_provide python3-net-snmp}
|
||||
#%package -n python2-net-snmp
|
||||
#%%{?python_provide:%%python_provide python2-net-snmp}
|
||||
#%%{?python_obsolete:%%python_obsolete python3-net-snmp}
|
||||
# Remove before F30
|
||||
#Provides: %%{name}-python = %%{version}-%%{release}
|
||||
#Provides: %%{name}-python%%{?_isa} = %%{version}-%%{release}
|
||||
@ -209,11 +196,25 @@ Net-SNMP toolkit library.
|
||||
#Summary: The Python 'netsnmp' module for the Net-SNMP
|
||||
#Requires: %%{name}-libs%%{?_isa} = %%{epoch}:%%{version}-%%{release}
|
||||
#
|
||||
#%%description -n python3-net-snmp
|
||||
#%%description -n python2-net-snmp
|
||||
#The 'netsnmp' module provides a full featured, tri-lingual SNMP (SNMPv3,
|
||||
#SNMPv2c, SNMPv1) client API. The 'netsnmp' module internals rely on the
|
||||
#Net-SNMP toolkit library.
|
||||
|
||||
%package -n python3-net-snmp
|
||||
%{?python_provide:%python_provide python3-net-snmp}
|
||||
# Remove before F30
|
||||
Provides: %{name}-python = %{version}-%{release}
|
||||
Provides: %{name}-python%{?_isa} = %{version}-%{release}
|
||||
Obsoletes: %{name}-python < %{version}-%{release}
|
||||
Summary: The Python 'netsnmp' module for the Net-SNMP
|
||||
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
|
||||
%description -n python3-net-snmp
|
||||
The 'netsnmp' module provides a full featured, tri-lingual SNMP (SNMPv3,
|
||||
SNMPv2c, SNMPv1) client API. The 'netsnmp' module internals rely on the
|
||||
Net-SNMP toolkit library.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
cp %{SOURCE10} .
|
||||
@ -246,7 +247,7 @@ cp %{SOURCE10} .
|
||||
%patch23 -p1 -b .CVE-2018-1000116
|
||||
%patch100 -p1 -b .openssl
|
||||
%patch101 -p1 -b .modern-rpm-api
|
||||
#%patch102 -p1
|
||||
%patch102 -p1
|
||||
|
||||
%ifarch sparc64 s390 s390x
|
||||
# disable failing test - see https://bugzilla.redhat.com/show_bug.cgi?id=680697
|
||||
@ -311,7 +312,7 @@ find perl/blib -type f -name "*.so" -print -exec chrpath --delete {} \;
|
||||
|
||||
# compile python module
|
||||
pushd python
|
||||
%{__python2} setup.py --basedir="../" build
|
||||
%{__python3} setup.py --basedir="../" build
|
||||
popd
|
||||
|
||||
|
||||
@ -372,7 +373,7 @@ install -m 644 local/mib2c.*.conf %{buildroot}%{_datadir}/snmp
|
||||
|
||||
# install python module
|
||||
pushd python
|
||||
%{__python2} setup.py --basedir=.. install -O1 --skip-build --root %{buildroot}
|
||||
%{__python3} setup.py --basedir=.. install -O1 --skip-build --root %{buildroot}
|
||||
popd
|
||||
|
||||
find %{buildroot} -name '*.so' | xargs chmod 0755
|
||||
@ -485,9 +486,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
||||
%{perl_vendorarch}/auto/*SNMP*
|
||||
%{perl_vendorarch}/auto/Bundle/*SNMP*
|
||||
|
||||
%files -n python2-net-snmp
|
||||
%files -n python3-net-snmp
|
||||
%doc README
|
||||
%{python2_sitearch}/*
|
||||
%{python3_sitearch}/*
|
||||
|
||||
%files gui
|
||||
%{_bindir}/tkmib
|
||||
@ -511,6 +512,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
||||
%{_libdir}/libnetsnmptrapd*.so.*
|
||||
|
||||
%changelog
|
||||
* Mon May 21 2018 Josef Ridky <jridky@redhat.com> - 1:5.7.3-39
|
||||
- python3 support draft
|
||||
|
||||
* Mon May 21 2018 Josef Ridky <jridky@redhat.com> - 1:5.7.3-38
|
||||
- revert Python3 support
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user