-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
84 lines (74 loc) · 3.13 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
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
import os.path as op
sys.path.insert(1,os.path.abspath('/home/lesca/Software/TGVQSM-master/deps'))
from glob import glob
from setuptools import setup, find_packages
import subprocess
version = {}
with open("nipic/version.py") as fp:
exec(fp.read(), version)
here = op.abspath(op.dirname(__file__))
short_description = 'Neuroimaging tools'
long_description = short_description
def replace_in_file(fn, s, repl):
with open(fn) as fin:
content = fin.read()
content = content.replace(s, repl)
with open(fn, 'w') as fout:
fout.write(content)
def make_resources():
print('Make resources before setup')
ui_module_path = op.join('piccel', 'ui', 'generated')
if not op.exists(ui_module_path):
os.makedirs(ui_module_path)
with open(op.join(ui_module_path, '__init__.py'), 'w') as fout:
fout.write('')
try:
dest_py_fn = op.join(ui_module_path, 'resources_rc.py')
rsrc_module_name = op.splitext(op.basename(dest_py_fn))[0]
cmd = ['pyrcc5', op.join('resources', 'resources.qrc'), '-o',
dest_py_fn]
subprocess.run(cmd)
for ui_fn in glob(op.join('resources', '*.ui')):
dest_py_fn = op.join(ui_module_path,
'%s_ui.py' % op.splitext(op.basename(ui_fn))[0 ])
cmd = ['pyuic5', '-x', ui_fn, '-o', dest_py_fn]
subprocess.run(cmd)
replace_in_file(dest_py_fn,
'import %s' % rsrc_module_name,
'from .%s import *' % rsrc_module_name)
except FileNotFoundError:
print('pyrcc5 command (PyQT5) not found')
sys.exit(1)
# make_resources()
setup(name='nipic', version=version['__version__'],
description=short_description,
long_description=long_description,
author='Thomas Vincent', license='MIT',
classifiers=['Development Status :: 3 - Alpha',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python :: 3.8',],
keywords='neuromaging mri segmentation freesurfer angiopathic lesions',
packages=find_packages(exclude=['test']),
python_requires='>=3',
install_requires=['nibabel', 'matplotlib', 'scikit-image', 'pyvista'],
extras_require={},
entry_points={
'console_scripts': [
'tag_csvd = nipic.commands.tag_angio_lesions:main',
'segment_csvd = nipic.commands.segment_csvd:main',
'fs_lut = nipic.commands.fs_lut:main',
'fs_seg_stats = nipic.commands.fs_stats_to_table:main',
'fs_recon_review = nipic.commands.fs_recon_review:main',
'dcm_export_to_nii = nipic.commands.dcm_export_to_nii:main',
'dcm_import_sort = nipic.commands.dcm_sort:main',
'mri_snap = nipic.commands.mri_snap:main'
],
})