summaryrefslogtreecommitdiff
path: root/math/py-simpleeval
diff options
context:
space:
mode:
authorrichard <richard@pkgsrc.org>2015-08-25 05:05:39 +0000
committerrichard <richard@pkgsrc.org>2015-08-25 05:05:39 +0000
commitfe1dcb88754c947a435f80fd82d3c01ae651d233 (patch)
tree89b70c4a953ee70da882e88bb48c2b7adc0c7b25 /math/py-simpleeval
parent3c66294f587a4fe25368cc4e8d81398533b20970 (diff)
downloadpkgsrc-fe1dcb88754c947a435f80fd82d3c01ae651d233.tar.gz
Add py-simpleeval
A quick single-file MIT-Licenced library for easily adding evaluatable expressions into python projects. Say you want to allow a user to set an alarm volume, which could depend on the time of day, alarm level, how many previous alarms had gone off, and if there is music playing at the time. Or if you want to allow simple formulae in a web application, but don't want to give full eval() access, or don't want to run in javascript on the client side. It's deliberately very simple, just a single file you can dump into a project, or import from pypi (pip or easy_install). Internally, it's using the amazing python ast module to parse the expression, which allows very fine control of what is and isn't allowed. It should be completely safe in terms of what operations can be performed by the expression. The only issue I know to be aware of is that you can create an expression which takes a long time to evaluate, or which evaluating requires an awful lot of memory, which leaves the potential for DOS attacks. There is basic protection against this, and you can lock it down further if you desire. You should be aware of this when deploying in a public setting. The defaults are pretty locked down and basic, and it's very easy to add whatever extra specific functionality you need (your own functions, variable/name lookup, etc).
Diffstat (limited to 'math/py-simpleeval')
-rw-r--r--math/py-simpleeval/DESCR1
-rw-r--r--math/py-simpleeval/Makefile18
-rw-r--r--math/py-simpleeval/PLIST8
-rw-r--r--math/py-simpleeval/distinfo5
4 files changed, 32 insertions, 0 deletions
diff --git a/math/py-simpleeval/DESCR b/math/py-simpleeval/DESCR
new file mode 100644
index 00000000000..3e0022404aa
--- /dev/null
+++ b/math/py-simpleeval/DESCR
@@ -0,0 +1 @@
+A simple, safe single expression evaluator library.
diff --git a/math/py-simpleeval/Makefile b/math/py-simpleeval/Makefile
new file mode 100644
index 00000000000..4cd94dc6303
--- /dev/null
+++ b/math/py-simpleeval/Makefile
@@ -0,0 +1,18 @@
+# $NetBSD: Makefile,v 1.1 2015/08/25 05:05:39 richard Exp $
+
+DISTNAME= simpleeval-0.8.2
+PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
+CATEGORIES= math
+MASTER_SITES= http://pypi.python.org/packages/source/s/simpleeval/
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= http://github.com/danthedeckie/simpleeval
+COMMENT= Simple, safe single expression evaluator library
+LICENSE= mit
+
+USE_LANGUAGES= # none
+
+PYTHON_VERSIONS_INCOMPATIBLE= 33 34
+
+.include "../../lang/python/egg.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/math/py-simpleeval/PLIST b/math/py-simpleeval/PLIST
new file mode 100644
index 00000000000..76839369ed2
--- /dev/null
+++ b/math/py-simpleeval/PLIST
@@ -0,0 +1,8 @@
+@comment $NetBSD: PLIST,v 1.1 2015/08/25 05:05:39 richard Exp $
+${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt
+${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
+${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
+${PYSITELIB}/${EGG_INFODIR}/top_level.txt
+${PYSITELIB}/simpleeval.py
+${PYSITELIB}/simpleeval.pyc
+${PYSITELIB}/simpleeval.pyo
diff --git a/math/py-simpleeval/distinfo b/math/py-simpleeval/distinfo
new file mode 100644
index 00000000000..7b12b7f819a
--- /dev/null
+++ b/math/py-simpleeval/distinfo
@@ -0,0 +1,5 @@
+$NetBSD: distinfo,v 1.1 2015/08/25 05:05:39 richard Exp $
+
+SHA1 (simpleeval-0.8.2.tar.gz) = ee345de583c739aa77b71bb3be23e6a14c6e6e0c
+RMD160 (simpleeval-0.8.2.tar.gz) = dfb2a6aefcd75b3812d52d548ab8d0949deb48ba
+Size (simpleeval-0.8.2.tar.gz) = 8282 bytes