Initial setuptools packaging
This commit is contained in:
parent
189889bd77
commit
19f49e038b
8 changed files with 51 additions and 15 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,4 +1,7 @@
|
|||
__pycache__
|
||||
build
|
||||
dist
|
||||
python3_validity.egg-info/
|
||||
tls.dict
|
||||
*.bin
|
||||
*.log
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ Originally designed to capture some of my findings for 138a:0097, but if you man
|
|||
|
||||
## Setting up
|
||||
|
||||
To install Python dependencies run
|
||||
On a Debian-based system, to re-install from sources (useful for testing):
|
||||
```
|
||||
$ pip3 install -r requirements.txt
|
||||
./setup.py install --force --install-layout deb --prefix=/usr --root=/
|
||||
```
|
||||
|
||||
## Initialization
|
||||
|
|
|
|||
0
led-dance.py → bin/validity-led-dance
Normal file → Executable file
0
led-dance.py → bin/validity-led-dance
Normal file → Executable file
0
validity-sensors-initializer.py → bin/validity-sensors-initializer
Normal file → Executable file
0
validity-sensors-initializer.py → bin/validity-sensors-initializer
Normal file → Executable file
37
dbus-service.py → dbus_service/dbus-service
Normal file → Executable file
37
dbus-service.py → dbus_service/dbus-service
Normal file → Executable file
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import dbus
|
||||
import dbus.mainloop.glib
|
||||
import dbus.service
|
||||
|
|
@ -20,12 +22,6 @@ GLib.threads_init()
|
|||
|
||||
INTERFACE_NAME='io.github.uunicorn.Fprint.Device'
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
|
||||
bus = dbus.SystemBus()
|
||||
bus_name = dbus.service.BusName('io.github.uunicorn.Fprint', bus)
|
||||
|
||||
loop = GObject.MainLoop()
|
||||
|
||||
usb.quit = lambda e: loop.quit()
|
||||
|
|
@ -36,7 +32,7 @@ def uid2identity(uid):
|
|||
return sid_from_string(sidstr)
|
||||
|
||||
class Device(dbus.service.Object):
|
||||
def __init__(self):
|
||||
def __init__(self, bus_name):
|
||||
dbus.service.Object.__init__(self, bus_name, '/io/github/uunicorn/Fprint/Device')
|
||||
|
||||
@dbus.service.method(dbus_interface=INTERFACE_NAME,
|
||||
|
|
@ -153,12 +149,27 @@ class Device(dbus.service.Object):
|
|||
logging.debug('EnrollStatus')
|
||||
|
||||
|
||||
init.open()
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser('Open fprintd DBus service')
|
||||
parser.add_argument('--debug', help='Enable tracing', action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
usb.trace_enabled = True
|
||||
tls.trace_enabled = True
|
||||
if args.debug:
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
svc = Device()
|
||||
loop.run()
|
||||
init.open()
|
||||
|
||||
usb.trace_enabled = True
|
||||
tls.trace_enabled = True
|
||||
|
||||
bus = dbus.SystemBus()
|
||||
bus_name = dbus.service.BusName('io.github.uunicorn.Fprint', bus)
|
||||
|
||||
svc = Device(bus_name)
|
||||
mgr = bus.get_object('net.reactivated.Fprint', '/net/reactivated/Fprint/Manager')
|
||||
mgr = dbus.Interface(mgr, 'net.reactivated.Fprint.Manager')
|
||||
mgr.RegisterDevice(svc)
|
||||
logging.debug('Registered')
|
||||
|
||||
loop.run()
|
||||
|
||||
print("Normal exit")
|
||||
20
setup.py
Executable file
20
setup.py
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
setup(name='python3-validity',
|
||||
version='0.1',
|
||||
py_modules = [],
|
||||
packages=['validitysensor'],
|
||||
scripts=[
|
||||
'bin/validity-led-dance',
|
||||
'bin/validity-sensors-initializer',
|
||||
],
|
||||
install_requires=[
|
||||
'cryptography >= 2.1.4',
|
||||
'pyusb >= 1.0.2'
|
||||
],
|
||||
data_files=[
|
||||
('lib/python-validity/', ['dbus_service/dbus-service']),
|
||||
]
|
||||
)
|
||||
1
validitysensor/__init__.py
Normal file
1
validitysensor/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
|
||||
|
|
@ -15,6 +15,7 @@ supported_devices=[
|
|||
|
||||
|
||||
def custom_match(d):
|
||||
print(d.address)
|
||||
return (d.idVendor, d.idProduct) in supported_devices
|
||||
|
||||
class Usb():
|
||||
|
|
|
|||
Loading…
Reference in a new issue