2019-04-08 07:14:02 +03:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
# distributed with this work for additional information
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
# with the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing,
|
|
|
|
# software distributed under the License is distributed on an
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
# KIND, either express or implied. See the License for the
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
# under the License.
|
2016-07-16 02:57:51 +03:00
|
|
|
import os
|
|
|
|
import sys
|
2017-10-09 02:55:47 +03:00
|
|
|
from setuptools import find_packages
|
2016-07-15 22:42:48 +03:00
|
|
|
from distutils.core import setup
|
|
|
|
|
2016-08-02 21:09:01 +03:00
|
|
|
def config_cython():
|
2017-09-27 08:24:37 +03:00
|
|
|
# temporary disable cython for now
|
|
|
|
# as NNVM uses local DLL build
|
|
|
|
return []
|
2016-08-02 21:09:01 +03:00
|
|
|
try:
|
|
|
|
from Cython.Build import cythonize
|
|
|
|
from distutils.extension import Extension
|
|
|
|
if sys.version_info >= (3, 0):
|
|
|
|
subdir = "_cy3"
|
|
|
|
else:
|
|
|
|
subdir = "_cy2"
|
|
|
|
ret = []
|
|
|
|
path = "nnvm/cython"
|
2016-07-16 02:57:51 +03:00
|
|
|
|
2016-08-02 21:09:01 +03:00
|
|
|
for fn in os.listdir(path):
|
|
|
|
if not fn.endswith(".pyx"):
|
|
|
|
continue
|
|
|
|
ret.append(Extension(
|
|
|
|
"nnvm/%s/%s" % (subdir, fn[:-4]),
|
|
|
|
["nnvm/cython/%s" % fn],
|
|
|
|
include_dirs=["../include/"],
|
|
|
|
language="c++"))
|
|
|
|
return cythonize(ret)
|
|
|
|
except:
|
|
|
|
print("Cython is not installed, will compile without cython module")
|
|
|
|
return []
|
2016-07-16 02:57:51 +03:00
|
|
|
|
2017-10-09 02:55:47 +03:00
|
|
|
# We can not import `libinfo.py` in setup.py directly since __init__.py
|
|
|
|
# Will be invoked which introduces dependences
|
|
|
|
CURRENT_DIR = os.path.dirname(__file__)
|
|
|
|
libinfo_py = os.path.join(CURRENT_DIR, './nnvm/libinfo.py')
|
|
|
|
libinfo = {'__file__': libinfo_py}
|
|
|
|
exec(compile(open(libinfo_py, "rb").read(), libinfo_py, 'exec'), libinfo, libinfo)
|
|
|
|
|
|
|
|
__version__ = libinfo['__version__']
|
2018-07-17 23:45:08 +03:00
|
|
|
if not os.getenv('CONDA_BUILD'):
|
|
|
|
LIB_PATH = libinfo['find_lib_path']()
|
|
|
|
_, LIB_NAME = os.path.split(LIB_PATH[0])
|
|
|
|
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
|
|
|
|
rpath = os.path.relpath(LIB_PATH[0], curr_path)
|
|
|
|
setup_kwargs = dict(
|
|
|
|
include_package_data=True,
|
|
|
|
data_files=[('nnvm', [rpath])]
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
setup_kwargs = {}
|
2017-10-09 02:55:47 +03:00
|
|
|
|
|
|
|
setup(name='nnvm',
|
2019-04-08 07:14:02 +03:00
|
|
|
version=__version__,
|
2017-10-09 02:55:47 +03:00
|
|
|
description="NNVM: Open Compiler for AI Frameworks",
|
|
|
|
zip_safe=False,
|
|
|
|
install_requires=[
|
|
|
|
'numpy'
|
|
|
|
],
|
|
|
|
packages=find_packages(),
|
|
|
|
url='https://github.com/dmlc/nnvm',
|
2018-07-17 23:45:08 +03:00
|
|
|
**setup_kwargs)
|