summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol2019-01-26 16:08:40 +0100
committers-ol2019-01-26 16:08:40 +0100
commit8d4e40f45fdb50b711915c0fe36ab31d1aebdf1f (patch)
tree82246401697dc88b67c41d81238a49b9d6f7f17b
downloadaur-8d4e40f45fdb50b711915c0fe36ab31d1aebdf1f.tar.gz
initial commit
-rw-r--r--.SRCINFO20
-rw-r--r--PKGBUILD26
-rw-r--r--fix-interface.patch65
-rw-r--r--setup.py13
4 files changed, 124 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..6f81991fe64e
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,20 @@
+pkgbase = python-leapmotion
+ pkgdesc = The Leapmotion python interface, compiled for python 3
+ pkgver = 2.3.1
+ pkgrel = 1
+ url = https://developer.leapmotion.com/downloads
+ arch = i686
+ arch = x86_64
+ license = unknown
+ makedepends = swig
+ makedepends = leap-motion-sdk
+ makedepends = python-setuptools
+ depends = python
+ depends = leap-motion-sdk
+ source = setup.py
+ source = fix-interface.patch
+ md5sums = ef0b9321730ef63d62363281b05f453f
+ md5sums = 8c72050df88146c07998d6bb43f56120
+
+pkgname = python-leapmotion
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..c627243bcde2
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,26 @@
+# Maintainer: Sol Bekic <s+aur [at] s-ol [dot] nu>
+
+pkgname=python-leapmotion
+pkgver=2.3.1
+pkgrel=1
+pkgdesc="The Leapmotion python interface, compiled for python 3"
+arch=('i686' 'x86_64')
+makedepends=('swig' 'leap-motion-sdk' 'python-setuptools')
+depends=('python' 'leap-motion-sdk')
+url="https://developer.leapmotion.com/downloads"
+license=('unknown')
+source=('setup.py' 'fix-interface.patch')
+md5sums=('ef0b9321730ef63d62363281b05f453f'
+ '8c72050df88146c07998d6bb43f56120')
+
+build() {
+ cp /usr/include/Leap{.h,Math.h} .
+ patch -i fix-interface.patch /usr/include/Leap.i -o Leap.i
+ swig -c++ -python -o LeapPython.cpp -interface LeapPython Leap.i
+
+ LEAP_VERSION="$pkgver" python setup.py build
+}
+
+package() {
+ LEAP_VERSION="$pkgver" python setup.py install --root="$pkgdir/" --optimize=1 --skip-build
+}
diff --git a/fix-interface.patch b/fix-interface.patch
new file mode 100644
index 000000000000..2302ec7dc7fd
--- /dev/null
+++ b/fix-interface.patch
@@ -0,0 +1,65 @@
+--- /usr/include/Leap.i 2019-01-25 12:36:21.000000000 +0100
++++ Leap.i 2019-01-26 15:17:38.023742750 +0100
+@@ -539,7 +539,7 @@
+ if _newclass:data = _swig_property(data)
+ __swig_getmethods__["distortion"] = distortion
+ if _newclass:distortion = _swig_property(distortion)
+-%}}
++}}
+
+ %extend Leap::Mask {
+ %pythoncode {
+@@ -549,7 +549,7 @@
+ return ptr
+ __swig_getmethods__["data"] = data
+ if _newclass:data = _swig_property(data)
+-%}}
++}}
+
+ %extend Leap::Frame {
+ %pythoncode {
+@@ -562,7 +562,7 @@
+ LeapPython.Frame_deserialize(self, tup[0], tup[1])
+ __swig_getmethods__["serialize"] = serialize
+ if _newclass:serialize = _swig_property(serialize)
+-%}}
++}}
+
+ %constattrib( Leap::Image, void*, dataPointer );
+ %constattrib( Leap::Image, void*, distortionPointer );
+@@ -988,7 +988,7 @@
+ %pythoncode {
+ def to_float_array(self): return [self.x, self.y, self.z]
+ def to_tuple(self): return (self.x, self.y, self.z)
+-%}}
++}}
+ %extend Leap::Matrix {
+ %pythoncode {
+ def to_array_3x3(self, output = None):
+@@ -1006,7 +1006,7 @@
+ output[8], output[9], output[10], output[11] = self.z_basis.x, self.z_basis.y, self.z_basis.z, 0.0
+ output[12], output[13], output[14], output[15] = self.origin.x, self.origin.y, self.origin.z, 1.0
+ return output
+-%}}
++}}
+
+ #endif
+
+@@ -1094,7 +1094,7 @@
+ while _pos < len(self):
+ yield self[_pos]
+ _pos += 1
+-%}}
++}}
+ %enddef
+
+ #else
+@@ -1153,7 +1153,7 @@
+ elif type == LeapPython.Config_TYPE_STRING:
+ return LeapPython.Config_set_string(self, *args)
+ return False
+-%}}
++}}
+ // Ignore methods that are unnecessary due to get and set functions defined above
+ %feature("shadow") Leap::Config::type(const std::string& key) const %{%}
+ %feature("shadow") Leap::Config::getBool(const std::string& key) const %{%}
diff --git a/setup.py b/setup.py
new file mode 100644
index 000000000000..c8d283b0bb2a
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,13 @@
+#! /usr/bin/env python
+import os
+from distutils.core import setup, Extension
+
+module = Extension('LeapPython',
+ libraries=['Leap'],
+ library_dirs=['/usr/lib/Leap'],
+ sources=['LeapPython.cpp'])
+
+setup(name='Leap',
+ version=os.environ['LEAP_VERSION'],
+ ext_modules=[module],
+ py_modules=["Leap"])