2015-09-28 19:56:37 -07:00
# pylint: disable=invalid-name, exec-used
""" Setup mxnet package. """
2015-08-05 22:51:03 -06:00
from __future__ import absolute_import
2016-09-07 16:08:55 -07:00
import os , sys
from distutils . core import setup
2015-08-05 22:51:03 -06:00
2015-09-28 19:56:37 -07:00
# We can not import `mxnet.info.py` in setup.py directly since mxnet/__init__.py
# Will be invoked which introduces dependences
CURRENT_DIR = os . path . dirname ( __file__ )
libinfo_py = os . path . join ( CURRENT_DIR , ' mxnet/libinfo.py ' )
libinfo = { ' __file__ ' : libinfo_py }
exec ( compile ( open ( libinfo_py , " rb " ) . read ( ) , libinfo_py , ' exec ' ) , libinfo , libinfo )
LIB_PATH = libinfo [ ' find_lib_path ' ] ( )
__version__ = libinfo [ ' __version__ ' ]
2015-08-05 22:51:03 -06:00
2016-09-07 16:08:55 -07:00
def config_cython ( ) :
try :
from Cython . Build import cythonize
from distutils . extension import Extension
if sys . version_info > = ( 3 , 0 ) :
subdir = " _cy3 "
else :
subdir = " _cy2 "
ret = [ ]
path = " mxnet/cython "
for fn in os . listdir ( path ) :
if not fn . endswith ( " .pyx " ) :
continue
ret . append ( Extension (
" mxnet/ %s / %s " % ( subdir , fn [ : - 4 ] ) ,
[ " mxnet/cython/ %s " % fn ] ,
include_dirs = [ " ../include/ " , " ../nnvm/include " ] ,
language = " c++ " ) )
return cythonize ( ret )
except :
print ( " WARNING: Cython is not installed, will compile without cython module " )
return [ ]
2015-08-05 22:51:03 -06:00
setup ( name = ' mxnet ' ,
2015-09-28 19:56:37 -07:00
version = __version__ ,
description = open ( os . path . join ( CURRENT_DIR , ' README.md ' ) ) . read ( ) ,
2015-08-05 22:51:03 -06:00
install_requires = [
2015-10-17 22:56:40 -07:00
' numpy ' ,
] ,
2015-08-05 22:51:03 -06:00
zip_safe = False ,
2016-12-27 02:30:45 +08:00
packages = [ ' mxnet ' , ' mxnet.module ' , ' mxnet.notebook ' ] ,
2015-08-05 22:51:03 -06:00
data_files = [ ( ' mxnet ' , [ LIB_PATH [ 0 ] ] ) ] ,
2016-09-07 16:08:55 -07:00
url = ' https://github.com/dmlc/mxnet ' ,
ext_modules = config_cython ( ) )