This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.py
97 lines (82 loc) · 3.16 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
#!/usr/bin/env python3
"""
Setup script for ghostdr
Based on the setup.py from the gemini_python distribution.
In this package:
ghostdr : Recipes and Primitives for GHOST
ghost_instruments : AstroData subclass for GHOST
Usage:
python setup.py install
"""
import os.path
import os
import re
import glob
import sys
from setuptools import setup, find_packages
ADLIB_PACKAGES = ['ghostdr']
gitdir = re.compile('.git')
fitsfile = re.compile('.fits$')
txtfile = re.compile('.txt$')
dotpy = re.compile('.py$')
dotsh = re.compile('.sh$')
# PACKAGE_DATA
PACKAGE_DATA = {}
for p in ADLIB_PACKAGES:
PACKAGE_DATA[p] = []
fitslist = []
txtlist = []
for root, dirs, files in os.walk(os.path.join(p, 'ghost', 'lookups')):
if not gitdir.search(root) and len(files) > 0:
fitsfiles = [f for f in files if fitsfile.search(f)]
dest = root.split('/',1)[1] if len(root.split('/',1)) > 1 else ""
PACKAGE_DATA[p].extend( map((lambda f: os.path.join(dest, f)), fitsfiles) )
fitslist.extend( map((lambda f: os.path.join(dest, f)), fitsfiles) )
txtfiles = [f for f in files if txtfile.search(f)]
dest = root.split('/',1)[1] if len(root.split('/',1)) > 1 else ""
PACKAGE_DATA[p].extend( map((lambda f: os.path.join(dest, f)), txtfiles) )
txtlist.extend( map((lambda f: os.path.join(dest, f)), txtfiles) )
# SCRIPTS
SCRIPTS = [os.path.join('simulator', 'testsim.py')]
for root, dirs, files in os.walk('utils'):
if not gitdir.search(root) and len(files) > 0:
files = [f for f in files if dotpy.search(f) or dotsh.search(f)]
dest = root.split('/',1)[1] if len(root.split('/',1)) > 1 else ""
SCRIPTS.extend( map((lambda f: os.path.join('utils', dest, f)), files) )
# PACKAGES
PACKAGES = find_packages(where='.', exclude=['ghostdr.ghost.test', 'ghostdr.ghost.recipes.test'])
PACKAGES.append('ghostdr.ghost.lookups.BPM')
PACKAGE_DIR = {"": "."}
SIMPACKAGES = find_packages(where=os.path.join('.', 'simulator'))
PACKAGES.extend(SIMPACKAGES)
for p in SIMPACKAGES:
PACKAGE_DIR[p] = os.path.join('.', 'simulator', p)
PACKAGE_DATA[p] = []
for root, dirs, files in os.walk(os.path.join('simulator', p, 'data')):
if not gitdir.search(root) and len(files) > 0:
dest = root.split('/',2)[2] if len(root.split('/',2)) > 2 else ""
PACKAGE_DATA[p].extend( map((lambda f: os.path.join(dest, f)), files) )
setup(
name='ghostdr',
version='1.1.1',
description='GHOST Data Reduction',
author="ANU & Gemini Observatory",
url="https://ghost-drtutorial.readthedocs.io/en/release-3.0.x/index.html",
#author='RSAA Software Engineering',
#author_email='[email protected]',
#url='http://rsaa.anu.edu.au',
maintainer='SUSD',
classifiers=[
'Development Status :: Alpha',
'Intended Audience :: Alpha Testers',
'Operating System :: Linux :: RHEL',
'Programming Language :: Python',
'Topic :: Gemini',
'Topic :: Data Reduction',
'Topic :: Astronomy',
],
packages=PACKAGES,
package_dir=PACKAGE_DIR,
package_data=PACKAGE_DATA,
scripts=SCRIPTS,
)