forked from simonsobs/sotodlib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
117 lines (97 loc) · 3.38 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
109
110
111
112
113
114
115
116
117
#!/usr/bin/env python3
import os
import sys
import re
import unittest
from setuptools import find_packages, setup, Extension
from setuptools.command.test import test as TestCommand
import versioneer
# The setup options
setup_opts = dict()
# Entry points / scripts. Add scripts here and define the main() of each
# script in sotodlib.scripts.<foo>.main()
setup_opts["entry_points"] = {
"console_scripts": [
"so_hardware_sim = sotodlib.scripts.hardware_sim:main",
"primecam_hardware_sim = sotodlib.scripts.hardware_sim_primecam:main",
"so_hardware_plot = sotodlib.scripts.hardware_plot:main",
"primecam_hardware_plot = sotodlib.scripts.hardware_plot_primecam:main",
"so_hardware_trim = sotodlib.scripts.hardware_trim:main",
"so_hardware_info = sotodlib.scripts.hardware_info:main",
"so-metadata = sotodlib.core.metadata.manifest:main",
]
}
pipes = [
"pipelines/toast_so_sim.py",
"pipelines/toast_so_example.py",
"pipelines/toast_bin_so3g.py",
"pipelines/toast_so_tf.py",
"pipelines/get_wafer_offset.py",
]
setup_opts["name"] = "sotodlib"
setup_opts["provides"] = "sotodlib"
setup_opts["version"] = versioneer.get_version()
setup_opts["description"] = "Simons Observatory TOD Simulation and Processing"
setup_opts["author"] = "Simons Observatory Collaboration"
setup_opts["author_email"] = "[email protected]"
setup_opts["url"] = "https://github.com/simonsobs/sotodlib"
setup_opts["packages"] = find_packages(where=".", exclude="tests")
setup_opts["license"] = "MIT"
setup_opts["requires"] = ["Python (>3.7.0)", ]
setup_opts["scripts"] = pipes
setup_opts["include_package_data"] = True
setup_opts["install_requires"] = [
'numpy',
'scipy',
'matplotlib',
'quaternionarray',
'PyYAML',
'toml',
'skyfield',
'pixell',
'scikit-image',
'pyfftw',
]
# Command Class dictionary.
# Begin with the versioneer command class dictionary.
cmdcls = versioneer.get_cmdclass()
# Class to run unit tests
class SOTestCommand(TestCommand):
def __init__(self, *args, **kwargs):
super(SOTestCommand, self).__init__(*args, **kwargs)
def initialize_options(self):
TestCommand.initialize_options(self)
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_suite = True
def mpi_world(self):
# We could avoid putting this here by defining a custom TextTestRunner
# that checked the per-process value "under-the-hood" and returned a
# False value from wasSuccessful() if any process failed.
comm = None
if "MPI_DISABLE" not in os.environ:
try:
from mpi4py import MPI
comm = MPI.COMM_WORLD
except Exception:
pass
return comm
def run(self):
loader = unittest.TestLoader()
runner = unittest.TextTestRunner(verbosity=2)
suite = loader.discover("tests", pattern="test_*.py",
top_level_dir=".")
ret = 0
local_ret = runner.run(suite)
if not local_ret.wasSuccessful():
ret = 1
comm = self.mpi_world()
if comm is not None:
ret = comm.allreduce(ret)
sys.exit(ret)
# Add our custom test runner
cmdcls["test"] = SOTestCommand
# Add command class to setup options
setup_opts["cmdclass"] = cmdcls
# Do the setup.
setup(**setup_opts)