-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
41 lines (34 loc) · 1.29 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
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import glob
import os
import shutil
import subprocess
from setuptools import setup, find_packages, Distribution
import setuptools.command.build_ext as _build_ext
class build_ext(_build_ext.build_ext):
def run(self):
# We build the C++ extension in a different directory to avoid
# having build artifacts in the package directory and make it
# easy to clean the build. This means we need to move the files
# here.
subprocess.check_call(["./build.sh"])
for path in glob.glob("build/lean.cpython*"):
directory, filename = os.path.split(path)
destination = os.path.join("lean", filename)
print("Copying {} to {}".format(path, destination))
shutil.copy(path, destination)
class BinaryDistribution(Distribution):
def has_ext_modules(self):
return True
setup(name="lean",
version="0.0.1",
packages=find_packages(),
install_requires=["numpy", "scipy", "tensorflow"],
cmdclass={"build_ext": build_ext},
# The BinaryDistribution argument triggers build_ext
distclass=BinaryDistribution,
include_package_data=True,
zip_safe=False,
license="Apache 2.0")