summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO19
-rw-r--r--.gitignore7
-rw-r--r--PKGBUILD29
-rw-r--r--python3.patch229
4 files changed, 284 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..41e70705fba
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,19 @@
+# Generated by makepkg 4.2.1
+# Mon Apr 6 16:01:49 UTC 2015
+pkgbase = python-linux-gpib
+ pkgdesc = A support package for GPIB (IEEE 488) hardware - Python 3 bindings
+ pkgver = 3.2.21
+ pkgrel = 4
+ url = http://linux-gpib.sourceforge.net/
+ arch = i686
+ arch = x86_64
+ license = GPL
+ depends = linux-gpib
+ depends = python
+ source = http://downloads.sourceforge.net/project/linux-gpib/linux-gpib%20for%203.x.x%20and%202.6.x%20kernels/3.2.21/linux-gpib-3.2.21.tar.gz
+ source = python3.patch
+ md5sums = 91e15d1a30c6e3fd79fc6762e8c1120e
+ md5sums = ba0a8b2bfbf7605b1b480ad424e3b7d3
+
+pkgname = python-linux-gpib
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000000..995bbc51413
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+pkg/*
+src/*
+*.tar.gz
+*.tar.xz
+*.tar.bz2
+*.zip
+*.swp
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..25e2500c8df
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,29 @@
+pkgname=('python-linux-gpib')
+_pkgname=('linux-gpib')
+pkgver=3.2.21
+pkgrel=4
+pkgdesc='A support package for GPIB (IEEE 488) hardware - Python 3 bindings'
+arch=('i686' 'x86_64')
+url='http://linux-gpib.sourceforge.net/'
+license=('GPL')
+depends=('linux-gpib' 'python')
+source=("http://downloads.sourceforge.net/project/${_pkgname}/${_pkgname}%20for%203.x.x%20and%202.6.x%20kernels/${pkgver}/${_pkgname}-${pkgver}.tar.gz"
+ "python3.patch")
+
+md5sums=('91e15d1a30c6e3fd79fc6762e8c1120e'
+ 'ba0a8b2bfbf7605b1b480ad424e3b7d3')
+
+build() {
+ cd "${srcdir}/${_pkgname}-${pkgver}"
+ patch -p1 < ../python3.patch
+ cd "${srcdir}/${_pkgname}-${pkgver}/language/python/"
+ python setup.py build
+}
+
+package() {
+ cd "${srcdir}/${_pkgname}-${pkgver}/language/python"
+ python setup.py install --prefix=/usr --root=${pkgdir}
+
+}
+
+# vim:ts=4:et:sw=4
diff --git a/python3.patch b/python3.patch
new file mode 100644
index 00000000000..febfc8b639d
--- /dev/null
+++ b/python3.patch
@@ -0,0 +1,229 @@
+--- a/language/python/gpibinter.c 2014-12-13 12:27:49.000000000 +0200
++++ b/language/python/gpibinter.c 2015-03-12 17:20:57.712141182 +0200
+@@ -98,7 +98,7 @@
+ _SetGpibError("find");
+ return NULL;
+ }
+- return PyInt_FromLong(ud);
++ return PyLong_FromLong(ud);
+ }
+
+ static char gpib_dev__doc__[] =
+@@ -126,7 +126,7 @@
+ _SetGpibError("dev");
+ return NULL;
+ }
+- return PyInt_FromLong(ud);
++ return PyLong_FromLong(ud);
+ }
+
+
+@@ -149,7 +149,7 @@
+ return NULL;
+ }
+
+- return PyInt_FromLong(result);
++ return PyLong_FromLong(result);
+ }
+
+
+@@ -177,7 +177,7 @@
+ return NULL;
+ }
+
+- return PyInt_FromLong(sta);
++ return PyLong_FromLong(sta);
+ }
+
+ static char gpib_listener__doc__[] =
+@@ -220,7 +220,7 @@
+ No copying needed, more efficient. (yes, this is legal, see
+ http://www.python.org/doc/current/api/stringObjects.html) */
+
+- retval = PyString_FromStringAndSize(NULL, len);
++ retval = PyUnicode_FromStringAndSize(NULL, len);
+ if(retval == NULL)
+ {
+ PyErr_SetString(GpibError, "Read Error: can't get Memory.");
+@@ -228,7 +228,7 @@
+ }
+
+ Py_BEGIN_ALLOW_THREADS
+- sta = ibrd(device, PyString_AS_STRING(retval), len);
++ sta = ibrd(device, PyUnicode_AS_UNICODE(retval), len);
+ Py_END_ALLOW_THREADS
+
+ if( sta & ERR )
+@@ -238,7 +238,7 @@
+ return NULL;
+ }
+
+- _PyString_Resize(&retval, ThreadIbcntl());
++ PyUnicode_Resize(&retval, ThreadIbcntl());
+ return retval;
+ }
+
+@@ -265,7 +265,7 @@
+ return NULL;
+ }
+
+- return PyInt_FromLong(sta);
++ return PyLong_FromLong(sta);
+ }
+
+ static char gpib_write_async__doc__[] =
+@@ -291,7 +291,7 @@
+ return NULL;
+ }
+
+- return PyInt_FromLong(sta);
++ return PyLong_FromLong(sta);
+ }
+
+
+@@ -318,7 +318,7 @@
+ return NULL;
+ }
+
+- return PyInt_FromLong(sta);
++ return PyLong_FromLong(sta);
+ }
+
+ static char gpib_remote_enable__doc__[] =
+@@ -343,7 +343,7 @@
+ return NULL;
+ }
+
+- return PyInt_FromLong(sta);
++ return PyLong_FromLong(sta);
+ }
+
+
+@@ -368,7 +368,7 @@
+ return NULL;
+ }
+
+- return PyInt_FromLong(sta);
++ return PyLong_FromLong(sta);
+ }
+
+
+@@ -393,7 +393,7 @@
+ return NULL;
+ }
+
+- return PyInt_FromLong(sta);
++ return PyLong_FromLong(sta);
+ }
+
+
+@@ -418,7 +418,7 @@
+ return NULL;
+ }
+
+- return PyInt_FromLong(sta);
++ return PyLong_FromLong(sta);
+ }
+
+
+@@ -443,7 +443,7 @@
+ return NULL;
+ }
+
+- return PyInt_FromLong(sta);
++ return PyLong_FromLong(sta);
+ }
+
+ static char gpib_wait__doc__[] =
+@@ -468,7 +468,7 @@
+ return NULL;
+ }
+
+- return PyInt_FromLong(sta);
++ return PyLong_FromLong(sta);
+ }
+
+ static char gpib_timeout__doc__[] =
+@@ -492,7 +492,7 @@
+ _SetGpibError("tmo");
+ return NULL;
+ }
+- return PyInt_FromLong(sta);
++ return PyLong_FromLong(sta);
+ }
+
+ static char gpib_serial_poll__doc__[] =
+@@ -541,7 +541,7 @@
+ return NULL;
+ }
+
+- return PyInt_FromLong(sta);
++ return PyLong_FromLong(sta);
+ }
+
+ static char gpib_ibsta__doc__[] =
+@@ -550,7 +550,7 @@
+
+ static PyObject* gpib_ibsta(PyObject *self, PyObject *args)
+ {
+- return PyInt_FromLong(ThreadIbsta());
++ return PyLong_FromLong(ThreadIbsta());
+ }
+
+ static char gpib_ibcnt__doc__[] =
+@@ -559,7 +559,7 @@
+
+ static PyObject* gpib_ibcnt(PyObject *self, PyObject *args)
+ {
+- return PyInt_FromLong(ThreadIbcntl());
++ return PyLong_FromLong(ThreadIbcntl());
+ }
+
+ /* List of methods defined in the module */
+@@ -598,13 +598,24 @@
+ "As in the C API, all functions return the value of ibsta,\n"
+ "except where otherwise specified.";
+
+-void initgpib(void)
++static struct PyModuleDef moduledef = {
++ PyModuleDef_HEAD_INIT,
++ "gpib",
++ gpib_module_documentation,
++ -1,
++ gpib_methods,
++ NULL,
++ NULL,
++ NULL,
++ NULL,
++};
++
++PyMODINIT_FUNC PyInit_gpib(void)
+ {
+ PyObject *m;
+
+ /* Create the module and add the functions */
+- m = Py_InitModule4("gpib", gpib_methods, gpib_module_documentation,
+- (PyObject*)NULL, PYTHON_API_VERSION);
++ m = PyModule_Create(&moduledef);
+
+ /* Add GpibError exception to the module */
+ GpibError = PyErr_NewException("gpib.GpibError", NULL, NULL);
+@@ -697,4 +708,6 @@
+ /* Check for errors */
+ if (PyErr_Occurred())
+ Py_FatalError("can't initialize module gpib");
++
++ return m;
+ }
+
+--- a/language/python/Gpib.py (original)
++++ b/language/python/Gpib.py (refactored)
+@@ -17,7 +17,7 @@
+
+ def __init__(self, name = 'gpib0', pad = None, sad = 0, timeout = 13, send_eoi = 1, eos_mode = 0):
+ self._own = False
+- if isinstance(name, basestring):
++ if isinstance(name, str):
+ self.id = gpib.find(name)
+ self._own = True
+ elif pad is None: