forked from datalad/datalad-neuroimaging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·113 lines (101 loc) · 3.74 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
#!/usr/bin/env python
from setuptools import setup
from setuptools import find_packages
from setuptools import findall
from os.path import join as opj
from os.path import sep as pathsep
from os.path import splitext
from os.path import dirname
from setup_support import BuildManPage
from setup_support import BuildRSTExamplesFromScripts
from setup_support import get_version
def findsome(subdir, extensions):
"""Find files under subdir having specified extensions
Leading directory (datalad) gets stripped
"""
return [
f.split(pathsep, 1)[1] for f in findall(opj('datalad_neuroimaging', subdir))
if splitext(f)[-1].lstrip('.') in extensions
]
# extension version
version = get_version()
cmdclass = {
'build_manpage': BuildManPage,
'build_examples': BuildRSTExamplesFromScripts,
}
# PyPI doesn't render markdown yet. Workaround for a sane appearance
# https://github.com/pypa/pypi-legacy/issues/148#issuecomment-227757822
README = opj(dirname(__file__), 'README.md')
try:
import pypandoc
long_description = pypandoc.convert(README, 'rst')
except (ImportError, OSError) as exc:
# attempting to install pandoc via brew on OSX currently hangs and
# pypandoc imports but throws OSError demanding pandoc
print(
"WARNING: pypandoc failed to import or thrown an error while converting"
" README.md to RST: %r .md version will be used as is" % exc
)
long_description = open(README).read()
requires = {
'devel-docs': [
# used for converting README.md -> .rst for long_description
'pypandoc',
# Documentation
'sphinx>=1.6.2',
'sphinx-rtd-theme',
],
'devel-downstream': [
# 3rd party modules which depend on datalad and we test against
'heudiconv',
]
}
requires['devel'] = sum(list(requires.values()), [])
setup(
# basic project properties can be set arbitrarily
name="datalad_neuroimaging",
author="The DataLad Team and Contributors",
author_email="[email protected]",
version=version,
description="DataLad extension package for neuro/medical imaging",
long_description=long_description,
zip_safe=False,
packages=[pkg for pkg in find_packages('.') if pkg.startswith('datalad')],
# datalad command suite specs from here
install_requires=[
'datalad>=0.11',
#'datalad-webapp',
'pydicom', # DICOM metadata
# >= 0.9.2 for https://github.com/bids-standard/pybids/pull/444
'pybids>=0.9.2', # BIDS metadata
'nibabel', # NIfTI metadata
'pandas', # bids2scidata export
],
extras_require=requires,
cmdclass=cmdclass,
package_data={
'datalad_neuroimaging':
findsome(opj('tests', 'data', 'files'), {'dcm', 'gz'}) +
findsome('resources', {'py', 'txt'})},
entry_points = {
# 'datalad.extensions' is THE entrypoint inspected by the datalad API builders
'datalad.extensions': [
# the label in front of '=' is the command suite label
# the entrypoint can point to any symbol of any name, as long it is
# valid datalad interface specification (see demo in this extension)
'neuroimaging=datalad_neuroimaging:command_suite',
],
'datalad.webapps': [
'pork=webapp.app:Pork',
],
'datalad.metadata.extractors': [
'bids=datalad_neuroimaging.extractors.bids:MetadataExtractor',
'dicom=datalad_neuroimaging.extractors.dicom:MetadataExtractor',
'nidm=datalad_neuroimaging.extractors.nidm:MetadataExtractor',
'nifti1=datalad_neuroimaging.extractors.nifti1:MetadataExtractor',
],
'datalad.tests': [
'neuroimaging=datalad_neuroimaging',
],
},
)