Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ynsta/steamcontroller.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStany MARCEL <stanypub@gmail.com>2015-11-16 23:21:56 +0300
committerStany MARCEL <stanypub@gmail.com>2015-11-16 23:21:56 +0300
commitdf6bb67c97e7185f6f5fae9906f33a1d224593c0 (patch)
treed121570d30c690c3a392066d17295c0ff20380c0 /src
parent02d8286dcf945bdadc47254268acb808c090dfa5 (diff)
Correct lib so file extension for pypy
Signed-off-by: Stany MARCEL <stanypub@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/tools.py11
-rw-r--r--src/uinput.py4
2 files changed, 13 insertions, 2 deletions
diff --git a/src/tools.py b/src/tools.py
index 1ceb6b1..fd2197b 100644
--- a/src/tools.py
+++ b/src/tools.py
@@ -22,11 +22,22 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
+"""Misc Tools"""
+
+import imp
+
def static_vars(**kwargs):
"""Static variable func decorator"""
def decorate(func):
+ """inner function used to add kwargs attribute to a func"""
for k in kwargs:
setattr(func, k, kwargs[k])
return func
return decorate
+
+def get_so_extension():
+ """Return so file extenstion compatible with python and pypy"""
+ for ext, _, typ in imp.get_suffixes():
+ if typ == imp.C_EXTENSION:
+ return ext
diff --git a/src/uinput.py b/src/uinput.py
index 17c8093..c56cfa4 100644
--- a/src/uinput.py
+++ b/src/uinput.py
@@ -30,7 +30,7 @@ from math import pow as mpow
from enum import IntEnum
from steamcontroller.cheader import defines
-from distutils.sysconfig import get_config_var
+from steamcontroller.tools import get_so_extension
from collections import deque
@@ -200,7 +200,7 @@ class UInput(object):
os.path.join(
os.path.dirname(__file__),
'..',
- 'libuinput' + get_config_var('SO'))))
+ 'libuinput' + get_so_extension())))
self._lib = ctypes.CDLL(lib)
c_k = (ctypes.c_uint16 * len(self._k))(*self._k)