aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Postiglione <andrea.postiglione@gmail.com>2022-04-02 15:26:37 +0200
committerAndrea Postiglione <andrea.postiglione@gmail.com>2022-04-02 15:26:37 +0200
commitb74f56d404379fa3d4e1a7256ddd0f14a34ecfc5 (patch)
treea1633839e0359255eb7a0c64e592bbbe958516b9
parentgames-engines/fs2_open: Bump to 22.0.0, Added 'clang' USE flag (diff)
downloadguru-b74f56d404379fa3d4e1a7256ddd0f14a34ecfc5.tar.gz
guru-b74f56d404379fa3d4e1a7256ddd0f14a34ecfc5.tar.bz2
guru-b74f56d404379fa3d4e1a7256ddd0f14a34ecfc5.zip
dev-python/pyagentx-0.4 first release
Signed-off-by: Andrea Postiglione <andrea.postiglione@gmail.com>
-rw-r--r--dev-python/pyagentx/Manifest5
-rw-r--r--dev-python/pyagentx/files/python3.patch255
-rw-r--r--dev-python/pyagentx/files/updater.patch27
-rw-r--r--dev-python/pyagentx/metadata.xml16
-rw-r--r--dev-python/pyagentx/pyagentx-0.4.ebuild21
5 files changed, 324 insertions, 0 deletions
diff --git a/dev-python/pyagentx/Manifest b/dev-python/pyagentx/Manifest
new file mode 100644
index 000000000..6037dcd45
--- /dev/null
+++ b/dev-python/pyagentx/Manifest
@@ -0,0 +1,5 @@
+AUX python3.patch 7481 BLAKE2B 2142c64935f067f88e7a59daa505a6ae4f44b5999191d43787fd9e2bddc6e79bf1a687c4ee341677958ba473f5f347a19a2ec0c09da3ab6049f2d3423c72ba50 SHA512 6b3a57c8bb5436b2a32970051a91d22f3c990aa52130c85ffc44a77413d424926f88f96426d2ce60b0123ee0b9b6a20c33fe485e591e048a7ac2783d97ad1a9b
+AUX updater.patch 798 BLAKE2B 3e8ada0c8cef641b490cd797f8e610e7b6bc30443c65510d050cc8d0ca417fde58b2046ab2da6947cb8246c3bc36588e2936d5aaa76fd6c79a2a552d36d29a28 SHA512 d19e5647c9a0879908f93adf1d295f2ef4e35de48185824db6e0145cf78d85597a9f597fa2408aa1db009b100360fe5337f05a373e7c5b9ae9e8e5166f9d8f0e
+DIST pyagentx-0.4.tar.gz 11353 BLAKE2B 1ae8197431a60651de61577d384ff3168ee2beb4bf6ce5cb2ccb4fbd9482f808c875301225e2d871e3fde94828e3291604f61e358570074b64af2271005e3f7f SHA512 2c13dc04b926fa0d6d7df24d577fc37d08440145adbc5e9ec45f99157da40d92afd7bd7e875e3d980b83330ee66ccde8649698cd967c150056db19cbbc4f7f6b
+EBUILD pyagentx-0.4.ebuild 493 BLAKE2B a12f8e9d5ace3b69ca67edc5766d9e367e3c8761d3e42868c65f249712db57cd37a6408d0c70c48acd922f9c6a6f74226f3606a79aa620ad84ea4739b57ab7a8 SHA512 3a12026be830c0bf488d551e1819be58bdc39e69d1df99ab019317d90e1d37eb1d0fc595c8ad0cecc3a263867c98a5edbc24845d0a8e85ff06fd3e747d4369d6
+MISC metadata.xml 626 BLAKE2B c3db5c408e852c05ab7b0eee7feef9cd52d2f42b7180b4a1071087f94e5326bb7797d2865bc8cb0612a3537b4ea870a8e1010c5975c52127957bf3ca575b6546 SHA512 c3e9f17b07bb9f1ba849901a3697552dd015242f08856a156642532d7eec9180efc02d6af2846c5b211b7f71c1f79cc9c7d6ff40a783b6bc0c8a2d27f51e5f3b
diff --git a/dev-python/pyagentx/files/python3.patch b/dev-python/pyagentx/files/python3.patch
new file mode 100644
index 000000000..63ea7d1a6
--- /dev/null
+++ b/dev-python/pyagentx/files/python3.patch
@@ -0,0 +1,255 @@
+commit dd1f0e84f8e321789264aec5ada0f1cb4d9ac8af
+Author: Ondrej Mular <omular@redhat.com>
+Date: Tue Nov 21 08:40:55 2017 +0100
+
+ Port to python3
+
+diff --git a/pyagentx/__init__.py b/pyagentx/__init__.py
+index efeef10..d4fd627 100644
+--- a/pyagentx/__init__.py
++++ b/pyagentx/__init__.py
+@@ -1,5 +1,10 @@
+ #!/usr/bin/env python
+ # -*- coding: utf-8 -*-
++from __future__ import (
++ absolute_import,
++ division,
++ print_function,
++)
+
+ import logging
+
+diff --git a/pyagentx/agent.py b/pyagentx/agent.py
+index b6c0e2a..2db39db 100644
+--- a/pyagentx/agent.py
++++ b/pyagentx/agent.py
+@@ -1,5 +1,10 @@
+ #!/usr/bin/env python
+ # -*- coding: utf-8 -*-
++from __future__ import (
++ absolute_import,
++ division,
++ print_function,
++)
+
+ # --------------------------------------------
+ import logging
+@@ -11,8 +16,11 @@ logger.addHandler(NullHandler())
+ # --------------------------------------------
+
+ import time
+-import Queue
+ import inspect
++try:
++ import queue
++except ImportError:
++ import Queue as queue
+
+ import pyagentx
+ from pyagentx.updater import Updater
+@@ -57,18 +65,18 @@ class Agent(object):
+ pass
+
+ def start(self):
+- queue = Queue.Queue(maxsize=20)
++ update_queue = queue.Queue(maxsize=20)
+ self.setup()
+ # Start Updaters
+ for u in self._updater_list:
+ logger.debug('Starting updater [%s]' % u['oid'])
+ t = u['class']()
+- t.agent_setup(queue, u['oid'], u['freq'])
++ t.agent_setup(update_queue, u['oid'], u['freq'])
+ t.start()
+ self._threads.append(t)
+ # Start Network
+ oid_list = [u['oid'] for u in self._updater_list]
+- t = Network(queue, oid_list, self._sethandlers)
++ t = Network(update_queue, oid_list, self._sethandlers)
+ t.start()
+ self._threads.append(t)
+ # Do nothing ... just wait for someone to stop you
+diff --git a/pyagentx/network.py b/pyagentx/network.py
+index 9711398..f30edad 100644
+--- a/pyagentx/network.py
++++ b/pyagentx/network.py
+@@ -1,5 +1,10 @@
+ #!/usr/bin/env python
+ # -*- coding: utf-8 -*-
++from __future__ import (
++ absolute_import,
++ division,
++ print_function,
++)
+
+ # --------------------------------------------
+ import logging
+@@ -13,7 +18,10 @@ logger.addHandler(NullHandler())
+ import socket
+ import time
+ import threading
+-import Queue
++try:
++ import queue
++except ImportError:
++ import Queue as queue
+
+ import pyagentx
+ from pyagentx.pdu import PDU
+@@ -21,10 +29,10 @@ from pyagentx.pdu import PDU
+
+ class Network(threading.Thread):
+
+- def __init__(self, queue, oid_list, sethandlers):
++ def __init__(self, update_queue, oid_list, sethandlers):
+ threading.Thread.__init__(self)
+ self.stop = threading.Event()
+- self._queue = queue
++ self._queue = update_queue
+ self._oid_list = oid_list
+ self._sethandlers = sethandlers
+
+@@ -84,7 +92,7 @@ class Network(threading.Thread):
+ update_oid = item['oid']
+ update_data = item['data']
+ # clear values with prefix oid
+- for oid in self.data.keys():
++ for oid in list(self.data.keys()):
+ if oid.startswith(update_oid):
+ del(self.data[oid])
+ # insert updated value
+@@ -94,7 +102,7 @@ class Network(threading.Thread):
+ 'value':row['value']}
+ # recalculate reverse index if data changed
+ self.data_idx = sorted(self.data.keys(), key=lambda k: tuple(int(part) for part in k.split('.')))
+- except Queue.Empty:
++ except queue.Empty:
+ break
+
+
+diff --git a/pyagentx/pdu.py b/pyagentx/pdu.py
+index 0af8e82..ac02a77 100644
+--- a/pyagentx/pdu.py
++++ b/pyagentx/pdu.py
+@@ -1,5 +1,10 @@
+ #!/usr/bin/env python
+ # -*- coding: utf-8 -*-
++from __future__ import (
++ absolute_import,
++ division,
++ print_function,
++)
+
+ # --------------------------------------------
+ import logging
+@@ -68,10 +73,11 @@ class PDU(object):
+
+
+ def encode_octet(self, octet):
++ octet = octet.encode("utf-8")
+ buf = struct.pack('!L', len(octet))
+- buf += str(octet)
++ buf += octet
+ padding = ( 4 - ( len(octet) % 4 ) ) % 4
+- buf += chr(0)* padding
++ buf += chr(0).encode() * padding
+ return buf
+
+
+@@ -107,7 +113,7 @@ class PDU(object):
+
+
+ def encode(self):
+- buf = ''
++ buf = b''
+ if self.type == pyagentx.AGENTX_OPEN_PDU:
+ # timeout
+ buf += struct.pack('!BBBB', 5, 0, 0, 0)
+@@ -169,7 +175,7 @@ class PDU(object):
+ sub_ids.append(t[0])
+ oid = '.'.join(str(i) for i in sub_ids)
+ return oid, ret['include']
+- except Exception, e:
++ except Exception as e:
+ logger.exception('Invalid packing OID header')
+ logger.debug('%s' % pprint.pformat(self.decode_buf))
+
+@@ -196,7 +202,7 @@ class PDU(object):
+ buf = self.decode_buf[:l]
+ self.decode_buf = self.decode_buf[l+padding:]
+ return buf
+- except Exception, e:
++ except Exception as e:
+ logger.exception('Invalid packing octet header')
+
+
+@@ -204,7 +210,7 @@ class PDU(object):
+ try:
+ vtype,_ = struct.unpack('!HH', self.decode_buf[:4])
+ self.decode_buf = self.decode_buf[4:]
+- except Exception, e:
++ except Exception as e:
+ logger.exception('Invalid packing value header')
+ oid,_ = self.decode_oid()
+ if vtype in [pyagentx.TYPE_INTEGER, pyagentx.TYPE_COUNTER32, pyagentx.TYPE_GAUGE32, pyagentx.TYPE_TIMETICKS]:
+@@ -252,7 +258,7 @@ class PDU(object):
+ context = self.decode_octet()
+ logger.debug('Context: %s' % context)
+ return ret
+- except Exception, e:
++ except Exception as e:
+ logger.exception('Invalid packing: %d' % len(self.decode_buf))
+ logger.debug('%s' % pprint.pformat(self.decode_buf))
+
+diff --git a/pyagentx/sethandler.py b/pyagentx/sethandler.py
+index 30a2db5..97839b2 100644
+--- a/pyagentx/sethandler.py
++++ b/pyagentx/sethandler.py
+@@ -1,5 +1,10 @@
+ #!/usr/bin/env python
+ # -*- coding: utf-8 -*-
++from __future__ import (
++ absolute_import,
++ division,
++ print_function,
++)
+
+ # --------------------------------------------
+ import logging
+diff --git a/pyagentx/updater.py b/pyagentx/updater.py
+index 5fb06d4..711f87e 100644
+--- a/pyagentx/updater.py
++++ b/pyagentx/updater.py
+@@ -1,5 +1,10 @@
+ #!/usr/bin/env python
+ # -*- coding: utf-8 -*-
++from __future__ import (
++ absolute_import,
++ division,
++ print_function,
++)
+
+ # --------------------------------------------
+ import logging
+@@ -12,7 +17,11 @@ logger.addHandler(NullHandler())
+
+ import time
+ import threading
+-import Queue
++try:
++ import queue
++except ImportError:
++ import Queue as queue
++
+
+ import pyagentx
+
+@@ -39,7 +48,7 @@ class Updater(threading.Thread):
+ self.update()
+ self._queue.put_nowait({'oid': self._oid,
+ 'data':self._data})
+- except Queue.Full:
++ except queue.Full:
+ logger.error('Queue full')
+ except:
+ logger.exception('Unhandled update exception')
diff --git a/dev-python/pyagentx/files/updater.patch b/dev-python/pyagentx/files/updater.patch
new file mode 100644
index 000000000..6c0b9c4ab
--- /dev/null
+++ b/dev-python/pyagentx/files/updater.patch
@@ -0,0 +1,27 @@
+commit 1f0337b2d481d16936a4921498fe67614687bd38
+Author: Mohammed Alshohayeb <moshohayeb@gmail.com>
+Date: Tue Jun 30 14:40:00 2015 +0300
+
+ permit remote descendants of Updater to be useable
+
+diff --git a/pyagentx/agent.py b/pyagentx/agent.py
+index 173a966..b6c0e2a 100644
+--- a/pyagentx/agent.py
++++ b/pyagentx/agent.py
+@@ -12,6 +12,7 @@ logger.addHandler(NullHandler())
+
+ import time
+ import Queue
++import inspect
+
+ import pyagentx
+ from pyagentx.updater import Updater
+@@ -30,7 +31,7 @@ class Agent(object):
+ self._threads = []
+
+ def register(self, oid, class_, freq=10):
+- if Updater not in class_.__bases__:
++ if Updater not in inspect.getmro(class_):
+ raise AgentError('Class given isn\'t an updater')
+ # cleanup and test oid
+ try:
diff --git a/dev-python/pyagentx/metadata.xml b/dev-python/pyagentx/metadata.xml
new file mode 100644
index 000000000..30cc8f236
--- /dev/null
+++ b/dev-python/pyagentx/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>andrea.postiglione@gmail.com</email>
+ <name>Andrea Postiglione</name>
+ </maintainer>
+ <longdescription lang="en">
+ Pcs is a Corosync and Pacemaker configuration tool. It permits users to easily view, modify and
+ create Pacemaker based clusters. Pcs contains pcsd, a pcs daemon, which operates as a remote server
+ for pcs and provides a web UI.
+ </longdescription>
+ <upstream>
+ <remote-id type="github">ClusterLabs/pcs</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-python/pyagentx/pyagentx-0.4.ebuild b/dev-python/pyagentx/pyagentx-0.4.ebuild
new file mode 100644
index 000000000..10dfac0e2
--- /dev/null
+++ b/dev-python/pyagentx/pyagentx-0.4.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{7..10} )
+
+inherit distutils-r1
+
+DESCRIPTION="Python AgentX Implementation"
+HOMEPAGE="https://github.com/hosthvo/pyagentx"
+SRC_URI="https://github.com/hosthvo/pyagentx/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~amd64"
+
+PATCHES="${FILESDIR}/updater.patch
+ ${FILESDIR}/python3.patch"
+
+distutils_enable_tests pytest