This repository has been archived by the owner on Aug 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·91 lines (78 loc) · 2.61 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
#!/usr/bin/env python
# https://stackoverflow.com/a/44077346
# import atexit
import os
from contextlib import contextmanager
from distutils.command.install import install
from glob import glob
# https://stackoverflow.com/a/49867265
try:
from pip.download import PipSession
except ImportError:
from pip._internal.download import PipSession
try:
from pip.req import parse_requirements
except ImportError:
from pip._internal.req import parse_requirements
from setuptools import setup
from setuptools import find_packages
from subprocess import check_output
from subprocess import CalledProcessError
from warnings import filterwarnings
# I do not condone it, but we surpressing all warnings
filterwarnings('ignore')
# Latest tagged stable version
try:
__version__ = check_output(["git", "describe", "--tags"], shell=True).rstrip().split('-')[-1]
except CalledProcessError:
__version__ = '0.1'
# Install dependencies with failover/failsafe
try:
install_reqs = parse_requirements("pip-requirements.txt", session=PipSession())
__install_requires__ = [str(ir.req) for ir in install_reqs]
try:
__install_requires__ = filter('None'.__ne__, __install_requires__)
except ValueError:
pass
except Exception:
__install_requires__ = [
'matplotlib', 'numpy', 'h5py', 'Nose', 'ansicolor', 'traceback2', 'katcp>=0.6.2']
@contextmanager
def cwd(path):
oldpwd=os.getcwd()
os.chdir(path)
try:
yield
finally:
os.chdir(oldpwd)
class cmdatexit_install(install):
""""""
def run(self):
path = ''
install.run(self)
if os.path.exists(path):
with cwd(path):
print 'Installing %s from %s' % (path, os.getcwd())
setup(name='AVNTests',
version=__version__,
description='AVN Correlator Unit and Acceptance Testing based Framework',
long_description=open('README.md').read(),
license='GPL',
author='SKA SA DBE Team',
author_email='mmphego@ska.ac.za',
url='https://github.com/ska-sa/AVNTests',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Radio Telescope correlator builders',
'Operating System :: OS Independent',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Topic :: Scientific/Engineering :: Astronomy',
],
install_requires=__install_requires__,
dependency_links=['https://github.com/ska-sa/nosekatreport/tree/karoocbf'],
provides=['AVNTests'],
packages=find_packages(),
scripts=glob('scripts/*'),
# cmdclass={"install": cmdatexit_install, },
)
# end