Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Create a python package #66

Merged
merged 2 commits into from

2 participants

@kanzure
Collaborator

emokit can go on pypi, yo.

@qdot qdot merged commit 54944f9 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 24, 2013
  1. @kanzure
  2. @kanzure

    basic python packaging

    kanzure authored
This page is out of date. Refresh to see the latest.
View
1  python/MANIFEST.in
@@ -0,0 +1 @@
+include requirements.txt tests/*
View
17 python/Makefile
@@ -0,0 +1,17 @@
+SHELL := /bin/bash
+
+test:
+ nosetests-2.7 -s --verbosity=2
+
+clean:
+ rm -fr build dist
+ rm -fr *.egg-info
+ find . -name *.pyc -exec rm {} \;
+ find . -name *.swp -exec rm {} \;
+
+install:
+ python2.7 setup.py install
+
+upload: clean
+ python2.7 setup.py sdist upload
+
View
18 python/emokit/__init__.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+"""
+emokit - emotiv epoc reverse engineering
+~~~~~~~~~~~~~~~
+
+:copyright: (c) 2013 by ???
+:license: ???
+"""
+
+__title__ = "emokit"
+__version__ = "0.0.1"
+__build__ = 0x000001
+__author__ = "Bryan Bishop <kanzure@gmail.com>"
+__license__ = "???"
+__copyright__ = "Copyright 2013 Bryan Bishop"
+
+from . import emotiv
+from . import mouse_control
View
18 python/emotiv.py → python/emokit/emotiv.py
@@ -259,7 +259,7 @@ def getLinuxSetup(self):
i += 1
rawinputs.append([path, filename])
hiddevices = []
- #TODO: Add support for multiple USB sticks? make a bit more elegant
+ # TODO: Add support for multiple USB sticks? make a bit more elegant
for input in rawinputs:
try:
with open(input[0] + "/manufacturer", 'r') as f:
@@ -270,10 +270,10 @@ def getLinuxSetup(self):
serial = f.readline().strip()
f.close()
print "Serial: " + serial + " Device: " + input[1]
- #Great we found it. But we need to use the second one...
+ # Great we found it. But we need to use the second one...
hidraw = input[1]
id_hidraw = int(hidraw[-1])
- #The dev headset might use the first device, or maybe if more than one are connected they might.
+ # The dev headset might use the first device, or maybe if more than one are connected they might.
id_hidraw += 1
hidraw = "hidraw" + id_hidraw.__str__()
print "Serial: " + serial + " Device: " + hidraw + " (Active)"
@@ -324,7 +324,7 @@ def handler(self, data):
def setupPosix(self):
_os_decryption = False
if os.path.exists('/dev/eeg/raw'):
- #The decrpytion is handled by the Linux epoc daemon. We don't need to handle it there.
+ # The decrpytion is handled by the Linux epoc daemon. We don't need to handle it there.
_os_decryption = True
self.hidraw = open("/dev/eeg/raw")
else:
@@ -343,7 +343,7 @@ def setupPosix(self):
if _os_decryption:
self.packets.put_nowait(EmotivPacket(data))
else:
- #Queue it!
+ # Queue it!
self.packetsReceived += 1
tasks.put_nowait(data)
gevent.sleep(0)
@@ -352,10 +352,10 @@ def setupPosix(self):
return True
def setupCrypto(self, sn):
- type = 0 #feature[5]
+ type = 0 # feature[5]
type &= 0xF
type = 0
- #I believe type == True is for the Dev headset, I'm not using that. That's the point of this library in the first place I thought.
+ # I believe type == True is for the Dev headset, I'm not using that. That's the point of this library in the first place I thought.
k = ['\0'] * 16
k[0] = sn[-1]
k[1] = '\0'
@@ -384,8 +384,8 @@ def setupCrypto(self, sn):
k[13] = '\0'
k[14] = sn[-4]
k[15] = 'P'
- #It doesn't make sense to have more than one greenlet handling this as data needs to be in order anyhow. I guess you could assign an ID or something
- #to each packet but that seems like a waste also or is it? The ID might be useful if your using multiple headsets or usb sticks.
+ # It doesn't make sense to have more than one greenlet handling this as data needs to be in order anyhow. I guess you could assign an ID or something
+ # to each packet but that seems like a waste also or is it? The ID might be useful if your using multiple headsets or usb sticks.
key = ''.join(k)
iv = Random.new().read(AES.block_size)
cipher = AES.new(key, AES.MODE_ECB, iv)
View
4 python/mouse_control.py → python/emokit/mouse_control.py
@@ -3,10 +3,10 @@
from ctypes import cdll
import sys
-import platform
+import platform
import gevent
-from emotiv import Emotiv
+from emokit.emotiv import Emotiv
class Xlib:
def __init__(self):
View
3  python/render.py → python/emokit/render.py
@@ -11,7 +11,8 @@
from pygame import FULLSCREEN
import gevent
import sys
-from emotiv import Emotiv
+
+from emokit.emotiv import Emotiv
class Grapher(object):
def __init__(self, screen, name, i):
View
2  python/example.py
@@ -1,4 +1,4 @@
-import emotiv
+from emokit import emotiv
import gevent
if __name__ == "__main__":
View
3  python/requirements.txt
@@ -0,0 +1,3 @@
+gevent
+pycrypto
+ctypes
View
35 python/setup.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+from setuptools import setup
+import os
+
+import emokit
+
+long_description = None
+
+packages = [
+ "emokit",
+]
+
+requirements = open("requirements.txt", "r").read().split("\n")
+
+setup(
+ name="emokit",
+ version=emokit.__version__,
+ url="https://github.com/kanzure/emokit",
+ license="",
+ author="Bryan Bishop",
+ author_email="kanzure@gmail.com",
+ maintainer="Bryan Bishop",
+ maintainer_email="kanzure@gmail.com",
+ description="emotiv epoc eeg headset sdk",
+ long_description=long_description,
+ packages=packages,
+ install_requires=requirements,
+ scripts=[],
+ platforms="any",
+ zip_safe=False,
+ classifiers=[
+ "Operating System :: OS Independent",
+ "Programming Language :: Python",
+ ]
+)
View
9 python/tests/test_emokit.py
@@ -0,0 +1,9 @@
+# -*- encoding: utf-8 -*-
+from emokit.emotiv import Emotiv
+
+import unittest
+
+class TestEmotiv(unittest.TestCase):
+ def test_emotiv(self):
+ emotiv = Emotiv()
+
Something went wrong with that request. Please try again.