-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathsetup.py
More file actions
151 lines (133 loc) · 4.74 KB
/
setup.py
File metadata and controls
151 lines (133 loc) · 4.74 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/usr/bin/env python
import os
from glob import glob
import numpy
import configparser
from setuptools import setup, Extension
from setuptools.command.install import install
from Cython.Build import cythonize
def set_default_filestore(prefix, optfile):
config = configparser.ConfigParser()
config.read(optfile)
config.set("basic", "filestore", os.path.join(prefix, "db"))
config.set("webgl", "colormaps", os.path.join(prefix, "colormaps"))
with open(optfile, 'w') as fp:
config.write(fp)
class my_install(install):
def run(self):
install.run(self)
optfile = [f for f in self.get_outputs() if 'defaults.cfg' in f]
prefix = os.path.join(self.install_base, "share", "pycortex")
set_default_filestore(prefix, optfile[0])
self.copy_tree('filestore', prefix)
for root, folders, files in os.walk(prefix):
for folder in folders:
os.chmod(os.path.join(root, folder), 511)
for fname in files:
os.chmod(os.path.join(root, fname), 438)
# Files listed in MANIFEST.in are not copied in wheels, use data_files instead.
# data_files = [
# ('share/pycortex/colormaps', 'filestore/colormaps/RdBu.png'),
# ...
# ]
data_files = [
# [10:] to remove "filestore/"
('share/pycortex/' + os.path.dirname(file)[10:], [file])
for file in glob('filestore/**/*', recursive=True)
if os.path.isfile(file)
]
ctm = Extension('cortex.openctm', [
'cortex/openctm.pyx',
'OpenCTM-1.0.3/lib/openctm.c',
'OpenCTM-1.0.3/lib/stream.c',
'OpenCTM-1.0.3/lib/compressRAW.c',
'OpenCTM-1.0.3/lib/compressMG1.c',
'OpenCTM-1.0.3/lib/compressMG2.c',
'OpenCTM-1.0.3/lib/liblzma/Alloc.c',
'OpenCTM-1.0.3/lib/liblzma/LzFind.c',
'OpenCTM-1.0.3/lib/liblzma/LzmaDec.c',
'OpenCTM-1.0.3/lib/liblzma/LzmaEnc.c',
'OpenCTM-1.0.3/lib/liblzma/LzmaLib.c',],
libraries=['m'], include_dirs=[
'OpenCTM-1.0.3/lib/',
'OpenCTM-1.0.3/lib/liblzma/', numpy.get_include()],
define_macros=[
('LZMA_PREFIX_CTM', None),
('OPENCTM_BUILD', None),
('NPY_NO_DEPRECATED_API', 'NPY_1_7_API_VERSION'),
#('__DEBUG_', None),
]
)
formats = Extension('cortex.formats', ['cortex/formats.pyx'],
include_dirs=[numpy.get_include()])
DISTNAME = 'pycortex'
# VERSION is now automatically derived from git tags via setuptools-scm
DESCRIPTION = 'Python Cortical mapping software for fMRI data'
with open('README.md') as f:
LONG_DESCRIPTION = f.read()
AUTHOR = 'James Gao'
AUTHOR_EMAIL = 'james@jamesgao.com'
LICENSE = '2-clause BSD license'
URL = 'http://gallantlab.github.io/pycortex'
DOWNLOAD_URL = URL
with open('requirements.txt') as f:
INSTALL_REQUIRES = [
line.strip()
for line in f
if line.strip() and not line.lstrip().startswith('#')
]
setup(name=DISTNAME,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type='text/markdown',
author=AUTHOR,
author_email=AUTHOR_EMAIL,
license=LICENSE,
url=URL,
download_url=DOWNLOAD_URL,
packages=[
'cortex',
'cortex.webgl',
'cortex.mapper',
'cortex.dataset',
'cortex.blender',
'cortex.tests',
'cortex.quickflat',
'cortex.polyutils',
'cortex.export'
],
data_files=data_files,
ext_modules=cythonize([ctm, formats]),
package_data={
'cortex': [
'svgbase.xml',
'defaults.cfg',
'bbr.sch'
],
'cortex.webgl': [
'*.html',
'favicon.ico',
'resources/js/*.js',
'resources/js/ctm/*.js',
'resources/css/*.css',
'resources/css/images/*',
'resources/css/ui-lightness/*.css',
'resources/css/ui-lightness/images/*',
'resources/images/*'
]
},
setup_requires=['Cython', 'numpy'],
install_requires=INSTALL_REQUIRES,
# Don't use `extras_require` here. Put them in pyproject.toml .
cmdclass=dict(install=my_install),
include_package_data=True,
classifiers=[
'Development Status :: 6 - Mature',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Scientific/Engineering :: Visualization'
]
)