forked from pyhrf/pyhrf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·131 lines (108 loc) · 3.62 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from glob import glob
try:
from distribute_setup import use_setuptools
use_setuptools()
except ImportError:
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages, Extension
#######################
# Pre-install checks #
#######################
def dependCheck(checkers):
dflags = dict(zip( checkers.keys(), [True]*len(checkers) ))
for depName, checker in checkers.iteritems():
print 'Checking %s ... ' %depName,
if checker():print 'ok'
else:
print 'NOT OK!'
dflags[depName] = False
return dflags
def checkPyXML():
try:
import xml
except ImportError:
return False
return True
def checkPyhrf():
try:
import pyhrf
except ImportError,e :
print e
return False
return True
dependCheckers = {
'pyxml': checkPyXML,
}
dependFlags = dependCheck(dependCheckers)
cExtensions = [
Extension('pyhrf.jde.intensivecalc',
['src/pyhrf/jde/intensivecalc.c']),
Extension('pyhrf.boldsynth.pottsfield.pottsfield_c',
['src/pyhrf/boldsynth/pottsfield/pottsField.c']),
Extension('pyhrf.vbjde.UtilsC',
['src/pyhrf/vbjde/utilsmodule.c']),
Extension('pyhrf.cparcellation',
['src/pyhrf/cparcellation.c']),
## used to sample the GIG (not maintained)
## Extension('pyhrf.stats.cRandom',
## ['src/pyhrf/stats/cRandom.c'],
## libraries=['unuran', 'prng'],
## ),
]
try:
import numpy as np
except ImportError:
print 'Numpy should be installed prior to pyhrf installation'
sys.exit(1)
setup(
name="pyhrf", author='Thomas VINCENT, Philippe CIUCIU, Solveig BADILLO',
author_email='[email protected]',
version='0.3',
setup_requires=['numpy>=1.0'],
install_requires=['numpy>=1.0','matplotlib>=0.90.1','scipy>=0.7',
'nibabel', 'nipy', 'PyXML>=0.8.4'],
dependency_links = [],
package_dir = {'' : 'python'},
packages=find_packages('python'),
include_package_data=True,
include_dirs = [np.get_include()],
package_data={'pyhrf':['datafiles/*']},
ext_modules=cExtensions,
scripts=glob('./bin/*'),
platforms=['linux'],
zip_safe=False,
)
# optional deps and description of associated feature:
optional_deps = {
'sklearn' : '(scikit-learn) -- spatial ward parcellation',
'joblib' : 'local parallel feature (eg pyhrf_jde_estim -x local)',
'soma.workflow' : 'cluster parallel feature (eg pyhrf_jde_estim -x cluster)',
'PIL' : 'loading of image file as simulation maps',
'munkres' : 'computation of distance between parcellations',
'pygraphviz' : '(python-graph-core) -- save plot of simulation pipelines',
'PyQt4': 'viewer and xml editor',
}
def check_opt_dep(dep_name, dep_descrip):
"""
Return a message telling if dependency *dep_name* is available
with an import
"""
try:
__import__(dep_name)
except ImportError:
return '%s *NOT IMPORTABLE*, %s will *NOT* be available' %(dep_name,
dep_descrip)
return '%s is importable, %s will be available' %(dep_name, dep_descrip)
print 'Optional dependencies:'
print '\n'.join(['- '+ check_opt_dep(dn, dd) for dn, dd in optional_deps.items()])
print '\nIf the installation was successfull, you may run '\
'"pyhrf_maketests" to run package tests.\n'
print 'Report on installation:'
installCheckers = {
'Pyhrf main installation' : checkPyhrf,
}
dependCheck(installCheckers)