This repository was archived by the owner on Sep 1, 2019. It is now read-only.
forked from trezor/cython-hidapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
64 lines (59 loc) · 2.01 KB
/
Copy pathsetup.py
File metadata and controls
64 lines (59 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/python
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import os
import sys
hidapi_topdir = os.path.join(os.getcwd(), 'hidapi')
hidapi_include = os.path.join(hidapi_topdir, 'hidapi')
def hidapi_src(platform):
return os.path.join(hidapi_topdir, platform, 'hid.c')
if sys.platform.startswith('linux'):
modules = [
Extension('hid',
sources = ['hid.pyx', 'chid.pxd', hidapi_src('libusb')],
include_dirs = [hidapi_include, '/usr/include/libusb-1.0'],
libraries = ['usb-1.0', 'udev', 'rt'],
),
Extension('hidraw',
sources = ['hidraw.pyx', hidapi_src('linux')],
include_dirs = [hidapi_include],
libraries = ['udev', 'rt'],
)
]
if sys.platform.startswith('darwin'):
os.environ['CFLAGS'] = '-framework IOKit -framework CoreFoundation'
os.environ['LDFLAGS'] = ''
modules = [
Extension('hid',
sources = ['hid.pyx', 'chid.pxd', hidapi_src('mac')],
include_dirs = [hidapi_include],
libraries = [],
)
]
if sys.platform.startswith('win'):
modules = [
Extension('hid',
sources = ['hid.pyx', 'chid.pxd', hidapi_src('windows')],
include_dirs = [hidapi_include],
libraries = ['setupapi'],
)
]
setup(
name = 'hidapi',
version = '0.7.99-5',
description = 'A Cython interface to the hidapi from https://github.com/signal11/hidapi',
author = 'Gary Bishop',
author_email = 'gb@cs.unc.edu',
maintainer = 'Pavol Rusnak',
maintainer_email = 'stick@gk2.sk',
url = 'https://github.com/trezor/cython-hidapi',
package_dir = {'hid': 'hidapi/*'},
classifiers = [
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
],
cmdclass = {'build_ext': build_ext},
ext_modules = modules
)