forked from spacetelescope/wfc3tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·82 lines (71 loc) · 2.25 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
#!/usr/bin/env python
import os
import subprocess
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
try:
from distutils.config import ConfigParser
except ImportError:
from configparser import ConfigParser
conf = ConfigParser()
conf.read(['setup.cfg'])
# Get some config values
metadata = dict(conf.items('metadata'))
PACKAGENAME = metadata.get('package_name', 'wfc3tools')
DESCRIPTION = metadata.get('description', '')
AUTHOR = metadata.get('author', 'STScI')
AUTHOR_EMAIL = metadata.get('author_email', '[email protected]')
URL = metadata.get('url', 'https://wfc3tools.readthedocs.io/')
LICENSE = metadata.get('licesnce', 'BSD')
if os.path.exists('relic'):
sys.path.insert(1, 'relic')
import relic.release
else:
try:
import relic.release
except ImportError:
try:
subprocess.check_call(['git', 'clone',
'https://github.com/jhunkeler/relic.git'])
sys.path.insert(1, 'relic')
import relic.release
except subprocess.CalledProcessError as e:
print(e)
exit(1)
version = relic.release.get_info()
relic.release.write_template(version, PACKAGENAME)
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = ['wfc3tools/tests']
self.test_suite = True
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)
setup(
name=PACKAGENAME,
version=version.pep386,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
description=DESCRIPTION,
license=LICENSE,
url=URL,
classifiers=[
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Software Development :: Libraries :: Python Modules',
],
install_requires=[
'astropy',
],
tests_require=['pytest'],
packages=find_packages(),
package_data={PACKAGENAME: ['pars/*']},
cmdclass = {'test': PyTest}
)