-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
87 lines (73 loc) · 2.77 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
###########################################################################################
# Copyright ironArray SL 2021.
#
# All rights reserved.
#
# This software is the confidential and proprietary information of ironArray SL
# ("Confidential Information"). You shall not disclose such Confidential Information
# and shall use it only in accordance with the terms of the license agreement.
###########################################################################################
import os
from sys import platform
from skbuild import setup
import codecs
import os.path
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), "r") as fp:
return fp.read()
def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
if "IA_BUILD_VER" not in os.environ:
# We are not building wheels
line = line.split("-$IA_BUILD_VER")[0]
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")
BUILD_WHEELS = True if "BUILD_WHEELS" in os.environ else False
if not BUILD_WHEELS:
if os.path.exists("BUILD_WHEELS"):
BUILD_WHEELS = True
DESCRIPTION = "The Math Array Accelerator for Python"
with open("README.md") as f:
LONG_DESCRIPTION = f.read()
# Libraries to copy as 'data' in package
# Copying just 'libarray' seems good enough
if platform == "linux" or platform == "linux2":
copy_libs = ["libiarray.so", "libsvml.so", "libintlc.so.5"]
elif platform == "darwin":
copy_libs = ["libiarray.dylib", "libsvml.dylib"]
elif platform == "win32":
copy_libs = ["iarray.dll", "svml_dispmd.dll"]
else:
copy_libs = []
if BUILD_WHEELS:
print("BUILD_WHEELS mode is ON!")
install_requires = open("requirements-test.txt").read().split()
install_requires += open("requirements-runtime.txt").read().split()
package_info = dict(
package_dir={"iarray": "iarray"},
packages=["iarray", "iarray.py2llvm", "iarray.tests"],
package_data={"iarray": copy_libs},
install_requires=install_requires,
)
else:
# For some reason this is necessary for inplace compilation
# One can avoid using this if we nuke _skbuild/ next to iarray/
package_info = dict(
packages=["iarray"],
)
# Optional dependencies
doc_deps = open("requirements-doc.txt").read().split()
examples_deps = open("requirements-dev.txt").read().split()
setup(
name="iarray",
version=get_version("iarray/__init__.py"),
description=DESCRIPTION,
# long_description=LONG_DESCRIPTION,
python_requires=">=3.8",
extras_require={"doc": doc_deps, "examples": examples_deps},
**package_info,
)