pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

py-pystatsd: Import version 0.1.10



Module Name:	pkgsrc-wip
Committed By:	Min Sik Kim <minskim%NetBSD.org@localhost>
Pushed By:	minskim
Date:		Wed Jun 6 13:14:08 2018 -0700
Changeset:	7ca7277e9326badad3e9f285c664527579bc2a04

Modified Files:
	Makefile
Added Files:
	py-pystatsd/ALTERNATIVES
	py-pystatsd/DESCR
	py-pystatsd/Makefile
	py-pystatsd/PLIST
	py-pystatsd/distinfo
	py-pystatsd/patches/patch-pystatsd_____init____.py
	py-pystatsd/patches/patch-pystatsd_daemon.py
	py-pystatsd/patches/patch-pystatsd_server.py

Log Message:
py-pystatsd: Import version 0.1.10

pystatsd is a client and server implementation of Etsy's statsd
server, a front end/proxy for the Graphite stats collection and
graphing server.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=7ca7277e9326badad3e9f285c664527579bc2a04

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                           |   1 +
 py-pystatsd/ALTERNATIVES                           |   1 +
 py-pystatsd/DESCR                                  |   3 +
 py-pystatsd/Makefile                               |  19 ++++
 py-pystatsd/PLIST                                  |  22 +++++
 py-pystatsd/distinfo                               |   9 ++
 py-pystatsd/patches/patch-pystatsd_____init____.py |  13 +++
 py-pystatsd/patches/patch-pystatsd_daemon.py       |  49 ++++++++++
 py-pystatsd/patches/patch-pystatsd_server.py       | 105 +++++++++++++++++++++
 9 files changed, 222 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 252ad247df..b652007203 100644
--- a/Makefile
+++ b/Makefile
@@ -3592,6 +3592,7 @@ SUBDIR+=	py-pyside-tools
 SUBDIR+=	py-pyslha
 SUBDIR+=	py-pysph
 SUBDIR+=	py-pysphere
+SUBDIR+=	py-pystatsd
 SUBDIR+=	py-pyswisseph
 SUBDIR+=	py-pythia
 SUBDIR+=	py-pythics
diff --git a/py-pystatsd/ALTERNATIVES b/py-pystatsd/ALTERNATIVES
new file mode 100644
index 0000000000..82e3a5f04f
--- /dev/null
+++ b/py-pystatsd/ALTERNATIVES
@@ -0,0 +1 @@
+bin/pystatsd-server @PREFIX@/bin/pystatsd-server@PYVERSSUFFIX@
diff --git a/py-pystatsd/DESCR b/py-pystatsd/DESCR
new file mode 100644
index 0000000000..844779ac3f
--- /dev/null
+++ b/py-pystatsd/DESCR
@@ -0,0 +1,3 @@
+pystatsd is a client and server implementation of Etsy's statsd
+server, a front end/proxy for the Graphite stats collection and
+graphing server.
diff --git a/py-pystatsd/Makefile b/py-pystatsd/Makefile
new file mode 100644
index 0000000000..74594db8c6
--- /dev/null
+++ b/py-pystatsd/Makefile
@@ -0,0 +1,19 @@
+# $NetBSD$
+
+DISTNAME=	pystatsd-0.1.10
+PKGNAME=	${PYPKGPREFIX}-${DISTNAME}
+CATEGORIES=	misc
+MASTER_SITES=	${MASTER_SITE_PYPI:=p/pystatsd/}
+
+MAINTAINER=	minskim%NetBSD.org@localhost
+HOMEPAGE=	https://github.com/sivy/py-statsd
+COMMENT=	Client and server implementation of statsd
+LICENSE=	2-clause-bsd
+
+.include "../../lang/python/egg.mk"
+
+post-install:
+	${MV} ${DESTDIR}${PREFIX}/bin/pystatsd-server \
+		${DESTDIR}${PREFIX}/bin/pystatsd-server${PYVERSSUFFIX}
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/py-pystatsd/PLIST b/py-pystatsd/PLIST
new file mode 100644
index 0000000000..96d4be6800
--- /dev/null
+++ b/py-pystatsd/PLIST
@@ -0,0 +1,22 @@
+@comment $NetBSD$
+bin/pystatsd-server${PYVERSSUFFIX}
+${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
+${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
+${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt
+${PYSITELIB}/${EGG_INFODIR}/requires.txt
+${PYSITELIB}/${EGG_INFODIR}/top_level.txt
+${PYSITELIB}/pystatsd/__init__.py
+${PYSITELIB}/pystatsd/__init__.pyc
+${PYSITELIB}/pystatsd/__init__.pyo
+${PYSITELIB}/pystatsd/daemon.py
+${PYSITELIB}/pystatsd/daemon.pyc
+${PYSITELIB}/pystatsd/daemon.pyo
+${PYSITELIB}/pystatsd/gmetric.py
+${PYSITELIB}/pystatsd/gmetric.pyc
+${PYSITELIB}/pystatsd/gmetric.pyo
+${PYSITELIB}/pystatsd/server.py
+${PYSITELIB}/pystatsd/server.pyc
+${PYSITELIB}/pystatsd/server.pyo
+${PYSITELIB}/pystatsd/statsd.py
+${PYSITELIB}/pystatsd/statsd.pyc
+${PYSITELIB}/pystatsd/statsd.pyo
diff --git a/py-pystatsd/distinfo b/py-pystatsd/distinfo
new file mode 100644
index 0000000000..0ea3e0647b
--- /dev/null
+++ b/py-pystatsd/distinfo
@@ -0,0 +1,9 @@
+$NetBSD$
+
+SHA1 (pystatsd-0.1.10.tar.gz) = d6067eb44a0a28ef0886e86dda6e55757bc811f4
+RMD160 (pystatsd-0.1.10.tar.gz) = 2f9a9b2d1ecf6a67be9462f8fdd21e28d0e74f98
+SHA512 (pystatsd-0.1.10.tar.gz) = 1702dd1f39b9949fde23e13308542253d6a5e3ad03733282be92f981da44370467de92601fcdf11085fd6221442b2f0145604fc3b49daf66344115bf99e3108d
+Size (pystatsd-0.1.10.tar.gz) = 11884 bytes
+SHA1 (patch-pystatsd_____init____.py) = c26fa22d023f21c8d5f46370dc3aa393d6870b11
+SHA1 (patch-pystatsd_daemon.py) = d5a37086706b1fc3d53689c9a3ae39f0534765c4
+SHA1 (patch-pystatsd_server.py) = 299bd72f0a841cfe62b1d7d2c5aacf2a652a6f70
diff --git a/py-pystatsd/patches/patch-pystatsd_____init____.py b/py-pystatsd/patches/patch-pystatsd_____init____.py
new file mode 100644
index 0000000000..79da79528b
--- /dev/null
+++ b/py-pystatsd/patches/patch-pystatsd_____init____.py
@@ -0,0 +1,13 @@
+$NetBSD$
+
+Python 3 compatability.
+
+--- pystatsd/__init__.py.orig	2013-07-15 13:42:57.000000000 +0000
++++ pystatsd/__init__.py
+@@ -1,4 +1,4 @@
+-from statsd import Client
+-from server import Server
++from pystatsd.statsd import Client
++from pystatsd.server import Server
+ 
+ VERSION = (0, 1, 10)
diff --git a/py-pystatsd/patches/patch-pystatsd_daemon.py b/py-pystatsd/patches/patch-pystatsd_daemon.py
new file mode 100644
index 0000000000..e9094c012f
--- /dev/null
+++ b/py-pystatsd/patches/patch-pystatsd_daemon.py
@@ -0,0 +1,49 @@
+$NetBSD$
+
+Python 3 compatability.
+
+--- pystatsd/daemon.py.orig	2013-06-14 19:27:00.000000000 +0000
++++ pystatsd/daemon.py
+@@ -27,7 +27,7 @@ class Daemon(object):
+             if pid > 0:
+                 # First parent; exit.
+                 sys.exit(0)
+-        except OSError, e:
++        except OSError as e:
+             sys.stderr.write('Could not fork! %d (%s)\n' %
+                              (e.errno, e.strerror))
+             sys.exit(1)
+@@ -35,7 +35,7 @@ class Daemon(object):
+         # Disconnect from parent environment.
+         os.chdir('/')
+         os.setsid()
+-        os.umask(0022)
++        os.umask(0o022)
+ 
+         # Fork again.
+         try:
+@@ -43,7 +43,7 @@ class Daemon(object):
+             if pid > 0:
+                 # Second parent; exit.
+                 sys.exit(0)
+-        except OSError, e:
++        except OSError as e:
+             sys.stderr.write('Could not fork (2nd)! %d (%s)\n' %
+                              (e.errno, e.strerror))
+             sys.exit(1)
+@@ -98,13 +98,13 @@ class Daemon(object):
+             while 1:
+                 os.kill(pid, SIGTERM)
+                 time.sleep(0.1)
+-        except OSError, e:
++        except OSError as e:
+             e = str(e)
+             if e.find('No such process') > 0:
+                 if os.path.exists(self.pidfile):
+                     os.remove(self.pidfile)
+                 else:
+-                    print e
++                    print(e)
+                     sys.exit(1)
+ 
+     def restart(self, *args, **kw):
diff --git a/py-pystatsd/patches/patch-pystatsd_server.py b/py-pystatsd/patches/patch-pystatsd_server.py
new file mode 100644
index 0000000000..f66b7f6958
--- /dev/null
+++ b/py-pystatsd/patches/patch-pystatsd_server.py
@@ -0,0 +1,105 @@
+$NetBSD$
+
+Python 3 compatability.
+
+--- pystatsd/server.py.orig	2013-07-15 13:42:39.000000000 +0000
++++ pystatsd/server.py
+@@ -4,7 +4,7 @@ import threading
+ import time
+ import types
+ import logging
+-import gmetric
++from pystatsd import gmetric
+ from subprocess import call
+ from warnings import warn
+ # from xdrlib import Packer, Unpacker
+@@ -16,7 +16,7 @@ try:
+ except ImportError:
+     setproctitle = None
+ 
+-from daemon import Daemon
++from pystatsd.daemon import Daemon
+ 
+ 
+ __all__ = ['Server']
+@@ -141,7 +141,7 @@ class Server(object):
+         """
+         try:
+             self.flush()
+-        except Exception, e:
++        except Exception as e:
+             log.exception('Error while flushing: %s', e)
+         self._set_timer()
+ 
+@@ -157,14 +157,14 @@ class Server(object):
+         for k, (v, t) in self.counters.items():
+             if self.expire > 0 and t + self.expire < ts:
+                 if self.debug:
+-                    print "Expiring counter %s (age: %s)" % (k, ts -t)
++                    print("Expiring counter %s (age: %s)" % (k, ts -t))
+                 del(self.counters[k])
+                 continue
+             v = float(v)
+             v = v if self.no_aggregate_counters else v / (self.flush_interval / 1000)
+ 
+             if self.debug:
+-                print "Sending %s => count=%s" % (k, v)
++                print("Sending %s => count=%s" % (k, v))
+ 
+             if self.transport == 'graphite':
+                 msg = '%s.%s %s %s\n' % (self.counters_prefix, k, v, ts)
+@@ -183,13 +183,13 @@ class Server(object):
+         for k, (v, t) in self.gauges.items():
+             if self.expire > 0 and t + self.expire < ts:
+                 if self.debug:
+-                    print "Expiring gauge %s (age: %s)" % (k, ts - t)
++                    print("Expiring gauge %s (age: %s)" % (k, ts - t))
+                 del(self.gauges[k])
+                 continue
+             v = float(v)
+ 
+             if self.debug:
+-                print "Sending %s => value=%s" % (k, v)
++                print("Sending %s => value=%s" % (k, v))
+ 
+             if self.transport == 'graphite':
+                 # note: counters and gauges implicitly end up in the same namespace
+@@ -206,7 +206,7 @@ class Server(object):
+         for k, (v, t) in self.timers.items():
+             if self.expire > 0 and t + self.expire < ts:
+                 if self.debug:
+-                    print "Expiring timer %s (age: %s)" % (k, ts - t)
++                    print("Expiring timer %s (age: %s)" % (k, ts - t))
+                 del(self.timers[k])
+                 continue
+             if len(v) > 0:
+@@ -228,8 +228,8 @@ class Server(object):
+                 del(self.timers[k])
+ 
+                 if self.debug:
+-                    print "Sending %s ====> lower=%s, mean=%s, upper=%s, %dpct=%s, count=%s" \
+-                        % (k, min, mean, max, self.pct_threshold, max_threshold, count)
++                    print("Sending %s ====> lower=%s, mean=%s, upper=%s, %dpct=%s, count=%s"
++                        % (k, min, mean, max, self.pct_threshold, max_threshold, count))
+ 
+                 if self.transport == 'graphite':
+ 
+@@ -275,14 +275,14 @@ class Server(object):
+                 graphite.connect((self.graphite_host, self.graphite_port))
+                 graphite.sendall(stat_string)
+                 graphite.close()
+-            except socket.error, e:
++            except socket.error as e:
+                 log.error("Error communicating with Graphite: %s" % e)
+                 if self.debug:
+-                    print "Error communicating with Graphite: %s" % e
++                    print("Error communicating with Graphite: %s" % e)
+ 
+         if self.debug:
+-            print "\n================== Flush completed. Waiting until next flush. Sent out %d metrics =======" \
+-                % (stats)
++            print("\n================== Flush completed. Waiting until next flush. Sent out %d metrics ======="
++                % (stats))
+ 
+     def _set_timer(self):
+         self._timer = threading.Timer(self.flush_interval / 1000, self.on_timer)


Home | Main Index | Thread Index | Old Index