-
Notifications
You must be signed in to change notification settings - Fork 9
/
setup.py
executable file
·59 lines (50 loc) · 1.74 KB
/
setup.py
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
#!/usr/bin/python
# -*- mode: python; coding: utf-8 -*-
import sys
import subprocess
from setuptools import setup, Extension
extension_modules = list()
if sys.platform.startswith('linux'):
glib_headers = subprocess.check_output(
"pkg-config --cflags glib-2.0".split()).decode('utf-8')
glib_headers = glib_headers.strip().split("-I")
glib_headers = [x.strip() for x in glib_headers if x]
glib_libs = subprocess.check_output(
"pkg-config --libs glib-2.0".split()).decode('utf-8')
glib_libs = glib_libs.strip().split("-l")
glib_libs = [x.strip() for x in glib_libs if x]
if sys.version_info.major == 3:
boost_libs = ["boost_python-py34"]
else:
boost_libs = ["boost_python"]
extension_modules = [
Extension(
'gattlib',
['src/gattservices.cpp',
'src/beacon.cpp',
'src/bindings.cpp',
'src/gattlib.cpp',
'src/bluez/lib/uuid.c',
'src/bluez/attrib/gatt.c',
'src/bluez/attrib/gattrib.c',
'src/bluez/attrib/utils.c',
'src/bluez/attrib/att.c',
'src/bluez/src/shared/crypto.c',
'src/bluez/src/log.c',
'src/bluez/btio/btio.c'],
libraries=glib_libs + boost_libs + ["boost_thread", "bluetooth"],
include_dirs=glib_headers + ['src/bluez'],
define_macros=[('VERSION', '"5.25"')]
)
]
else:
raise OSError("Not supported OS")
setup(
name='gattlib',
version="0.20150805",
description="Library to access Bluetooth LE devices",
author="Oscar Acena",
author_email="[email protected]",
url="https://bitbucket.org/OscarAcena/pygattlib",
ext_modules=extension_modules,
)