generated from aboutcode-org/skeleton
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
31 lines (21 loc) · 853 Bytes
/
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
#!/usr/bin/env python
import subprocess
from distutils.command.build import build as distutils_build
from distutils.errors import LibError
import setuptools
from setuptools.command.develop import develop as setuptools_develop
def run_native_build():
exitcode, output = subprocess.getstatusoutput(["./build.sh"])
print(output)
if exitcode:
raise LibError("Unable to build native")
class BuildNative(distutils_build):
def run(self):
self.execute(run_native_build, (), msg="Building native code")
distutils_build.run(self)
class DevelopNative(setuptools_develop):
def run(self):
self.execute(run_native_build, (), msg="Building develop native code")
setuptools_develop.run(self)
if __name__ == "__main__":
setuptools.setup(cmdclass={"build": BuildNative, "develop": DevelopNative})