-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
100 lines (85 loc) · 2.93 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
import os
import re
import glob
import warnings
from setuptools import (setup, find_packages)
VCS_RQMT_PAT = re.compile('^\w+\+\w+:')
"""
The pattern for detecting a VCS requirement spec, e.g.
``git+git://...``.
"""
class InstallError(Exception):
"""qipipe installation error."""
pass
def version(package):
"""
:return: the package version as listed in the package `__init.py__`
`__version__` variable.
"""
# The version string parser.
REGEXP = re.compile("""
__version__ # The version variable
\s*=\s* # Assignment
['\"] # Leading quote
(.+) # The version string capture group
['\"] # Trailing quote
""", re.VERBOSE)
with open(os.path.join(package, '__init__.py')) as f:
match = REGEXP.search(f.read())
if not match:
raise InstallError("The Nipype __version__ variable was not found")
return match.group(1)
def requires():
with open('requirements.txt') as f:
return f.read().splitlines()
def dependency_links():
"""
Returns the non-PyPI ``qipipe`` requirements in
``constraints.txt`` which match the :const:`VCS_RQMT_PAT`
pattern.
:return: the non-PyPI package specifications
"""
# FIXME - broken: install from PyPi fails on dcmstack.
# Work-around is to clone qipipe repo and install with
# --constraint constraints.txt option, as described in
# doc/index.rst.
#
# TODO - revisit this yet again and eliminate doc step
# if fixed.
with open('constraints.txt') as f:
rqmts = f.read().splitlines()
# Match on git dependency links. Not a general solution, but
# good enough so far.
# TODO - revisit if Python 3 settles on a sane package manager.
return [rqmt for rqmt in rqmts if VCS_RQMT_PAT.match(rqmt)]
def readme():
with open("README.rst") as f:
return f.read()
setup(
name = 'qipipe',
version = version('qipipe'),
author = 'OHSU Knight Cancer Institute',
author_email = 'loneyf@ohsu.edu',
platforms = 'Any',
license = 'MIT',
keywords = 'Imaging QIN OHSU DCE MR XNAT Nipype',
packages = find_packages(exclude=['test**']),
package_data = dict(qipipe=['conf/*.cfg']),
scripts = glob.glob('bin/*'),
url = 'http://qipipe.readthedocs.org/en/latest/',
description = 'Quantitative Imaging Profile pipeline',
long_description = readme(),
classifiers = [
'Development Status :: 5 - Production/Stable',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
],
install_requires = requires(),
dependency_links = dependency_links()
)