forked from vortex-exoplanet/VIP
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
108 lines (93 loc) · 3.48 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
#!/usr/bin/env python
import os
import re
from setuptools import setup
try:
# pip >=20
from pip._internal.network.session import PipSession
from pip._internal.req import parse_requirements
except ImportError:
try:
# 10.0.0 <= pip <= 19.3.1
from pip._internal.download import PipSession
from pip._internal.req import parse_requirements
except ImportError:
# pip <= 9.0.3
from pip.download import PipSession
from pip.req import parse_requirements
from setuptools.command.install import install
from setuptools.command.develop import develop
# Hackishly override of the install method
class InstallReqs(install):
def run(self):
print(" ********************** ")
print(" *** Installing VIP *** ")
print(" ********************** ")
os.system('pip install -r requirements.txt')
install.run(self)
class InstallDevReqs(develop):
def run(self):
print(" **************************** ")
print(" *** Installing VIP (dev) *** ")
print(" **************************** ")
os.system('pip install -r requirements-dev.txt')
develop.run(self)
def resource(*args):
return os.path.join(os.path.abspath(os.path.join(__file__, os.pardir)),
*args)
# parse_requirements() returns generator of pip.req.InstallRequirement objects
reqs = parse_requirements(resource('requirements.txt'), session=PipSession)
try:
requirements = [str(ir.requirement) for ir in reqs]
except:
requirements = [str(ir.req) for ir in reqs]
reqs_dev = parse_requirements(resource('requirements-dev.txt'),
session=PipSession)
try:
requirements_dev = [str(ir.requirement) for ir in reqs_dev]
except:
requirements_dev = [str(ir.req) for ir in reqs_dev]
with open(resource('README.rst')) as readme_file:
README = readme_file.read()
with open(resource('vip_hci', '__init__.py')) as version_file:
version_file = version_file.read()
VERSION = re.search(r"""^__version__ = ['"]([^'"]*)['"]""",
version_file, re.M)
VERSION = VERSION.group(1)
PACKAGES = ['vip_hci',
'vip_hci.config',
'vip_hci.fits',
'vip_hci.fm',
'vip_hci.invprob',
'vip_hci.metrics',
'vip_hci.objects',
'vip_hci.preproc',
'vip_hci.psfsub',
'vip_hci.stats',
'vip_hci.var']
setup(
name='vip_hci',
version=VERSION,
description='Package for astronomical high-contrast image processing.',
long_description=README,
license='MIT',
author='Carlos Alberto Gomez Gonzalez, Valentin Christiaens',
author_email='[email protected]',
url='https://github.com/vortex-exoplanet/VIP',
cmdclass={'install': InstallReqs,
'develop': InstallDevReqs},
packages=PACKAGES,
install_requires=requirements,
extras_require={"dev": requirements_dev},
zip_safe=False,
classifiers=['Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux',
'Natural Language :: English',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Scientific/Engineering :: Astronomy'
]
)