-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
82 lines (66 loc) · 2.35 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 python3
import os
import sys
import re
import unittest
import shutil
import glob
from setuptools import find_packages, setup, Extension
from setuptools.command.test import test as TestCommand
from distutils.command.clean import clean as CleanCommand
import versioneer
# The setup options
setup_opts = dict()
# Entry points / scripts. Add scripts here and define the main() of each
# script in s4sim.scripts.<foo>.main()
setup_opts["entry_points"] = {
"console_scripts": [
"s4sim_testscript = s4sim.scripts.testscript:main",
"s4_hardware_sim = s4sim.scripts.s4_hardware_sim:main",
"s4_hardware_plot = s4sim.scripts.s4_hardware_plot:main",
"s4_hardware_trim = s4sim.scripts.s4_hardware_trim:main",
"s4_hardware_info = s4sim.scripts.s4_hardware_info:main",
]
}
pipes = ["pipelines/toast_s4_sim.py", "pipelines/pickle_hardware.py", "pipelines/s4_hardware_to_toast3.py"]
setup_opts["name"] = "s4sim"
setup_opts["provides"] = ["s4sim"]
setup_opts["version"] = versioneer.get_version()
setup_opts["description"] = "CMB-S4 Simulation Package"
setup_opts["author"] = "CMB-S4 Collaboration"
setup_opts["author_email"] = "[email protected]"
setup_opts["url"] = "https://github.com/CMB-S4/s4sim"
setup_opts["packages"] = find_packages(where=".")
setup_opts["license"] = "BSD"
setup_opts["requires"] = ["Python (>3.4.0)"]
setup_opts["scripts"] = pipes
# Command Class dictionary.
# Begin with the versioneer command class dictionary.
cmdcls = versioneer.get_cmdclass()
# Override the "clean" command to purge all build products.
class CustomClean(CleanCommand):
def run(self):
super().run()
clean_files = [
"./build",
"./dist",
"./__pycache__",
"s4sim/__pycache__",
"s4sim/tests/__pycache__",
"s4sim/scripts/__pycache__",
"./*.egg-info",
]
for cf in clean_files:
# Make paths absolute and relative to this path
apaths = glob.glob(os.path.abspath(cf))
for path in apaths:
if os.path.isdir(path):
shutil.rmtree(path)
elif os.path.isfile(path):
os.remove(path)
return
cmdcls["clean"] = CustomClean
# Add command class to setup options
setup_opts["cmdclass"] = cmdcls
# Do the setup.
setup(**setup_opts)