-
Notifications
You must be signed in to change notification settings - Fork 119
/
setup.py
77 lines (73 loc) · 2.54 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
#!/usr/bin/env python
# This is Yangqing's extremely hacky code to install decaf on your machine
# assuming that you are using a Unix-like system. To install, do:
# python setup.py build
# python setup.py install
# You should be able to then use decaf in your python environment.
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from distutils.util import convert_path
from fnmatch import fnmatchcase
import os
import sys
def find_packages(where='.'):
out = []
stack=[(convert_path(where), '')]
while stack:
where, prefix = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where,name)
if ('.' not in name and os.path.isdir(fn) and
os.path.isfile(os.path.join(fn, '__init__.py'))
):
out.append(prefix+name)
stack.append((fn, prefix+name+'.'))
for pat in ['ez_setup', 'distribute_setup']:
out = [item for item in out if not fnmatchcase(item, pat)]
return out
def run_setup():
if sys.version_info < (2, 7):
sys.stderr.write("Decaf requires Python >= 2.7\n")
exit(-1)
# Before running setup, let's do a make since we have C shared libraries
# to be build (note that they are not python extensions...)
# It's kind of ugly, but let's just keep it this way for simplicity
retval = os.system('cd decaf; make')
if retval != 0:
sys.stderr.write("Failed to build the C libraries; exiting.\n")
exit(retval)
setup(name='decaf',
version='0.9',
description='Deep convolutional neural network framework',
author='Yangqing Jia',
author_email='jiayq84@gmail.com',
packages=find_packages(),
package_data={'decaf': ['util/_data/*'],
'decaf.demos.jeffnet': ['static/*', 'templates/*'],
'decaf.demos.notebooks': ['*.ipynb'],
'decaf.layers.cpp': ['libcpputil.so'],
},
install_requires=[
'matplotlib',
'networkx',
'numexpr',
'numpy',
'pydot',
'scipy',
'scikit-image',
],
extras_require={
'benchmarks': ['theano'],
'mpi': ['mpi4py'],
'demo': [
'python-gflags',
'flask',
'tornado',
'PIL',
],
}
)
if __name__ == '__main__':
run_setup()