Skip to content
This repository was archived by the owner on Jul 20, 2025. It is now read-only.

Commit e90ae0a

Browse files
committed
Setup python build on Linux
0 parents  commit e90ae0a

File tree

5 files changed

+44
-0
lines changed

5 files changed

+44
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/build/
2+
/metawear.egg-info/
3+
mbientlab/metawear/*.so*
4+
mbientlab/metawear/cbindings.py
5+
*.pyc

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "MetaWear-SDK-Cpp"]
2+
path = MetaWear-SDK-Cpp
3+
url = [email protected]:mbientlab/MetaWear-SDK-Cpp.git

MetaWear-SDK-Cpp

Submodule MetaWear-SDK-Cpp added at d81a6d3

mbientlab/metawear/__init__.py

Whitespace-only changes.

setup.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import os
2+
import sys
3+
from distutils.dir_util import copy_tree
4+
from shutil import copy2
5+
from subprocess import call, STDOUT
6+
from setuptools import setup
7+
from setuptools.command.install import install
8+
9+
machine = "x64" if sys.maxsize > 2**32 else "x86"
10+
11+
class MetaWearInstall(install):
12+
def run(self):
13+
dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))
14+
status = call(["make", "-C", "MetaWear-SDK-Cpp", "OPT_FLAGS=-Wno-strict-aliasing", "-j"], cwd=dir, stderr=STDOUT)
15+
if (status != 0):
16+
raise RuntimeError("Failed to compile C++ SDK")
17+
18+
copy_tree('MetaWear-SDK-Cpp/dist/release/lib/%s/' % (machine), "mbientlab/metawear")
19+
copy2('MetaWear-SDK-Cpp/bindings/python/mbientlab/metawear/cbindings.py', "mbientlab/metawear")
20+
21+
install.run(self)
22+
23+
setup(
24+
name='metawear',
25+
packages=['mbientlab.metawear'],
26+
version='0.1.0',
27+
description='Python bindings for the MetaWear C++ SDK',
28+
package_data={'mbientlab.metawear': ['libmetawear.so*']},
29+
include_package_data=True,
30+
url='https://github.com/mbientlab/MetaWear-SDK-Python',
31+
author='MbientLab',
32+
cmdclass={
33+
'install': MetaWearInstall,
34+
}
35+
)

0 commit comments

Comments
 (0)