-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetup.py
73 lines (63 loc) · 1.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
from pathlib import Path
from setuptools import setup
import sys
import subprocess as subp
import platform
import os
cwd = Path(__file__).parent
sys.path.append(str(cwd))
from cmake_ext import CMakeExtension, CMakeBuild # noqa: E402
if not os.environ.get("CI", False):
if (cwd / ".git").exists():
# make sure that submodules are up-to-date,
# it is a common error to forget this when
# switching between development branches
subp.check_call(["git", "submodule", "update"])
models = [
"eposlhc",
"sib21",
"sib23",
"sib23d",
"sib23c01",
"qgs01",
"qgsII03",
"qgsII04",
"pythia6",
"sophia",
"dpmjet306",
"phojet112",
"phojet191",
"phojet193",
"dpmjetIII191",
"dpmjetIII193",
]
# urqmd34 doesn't build correctly on Windows
if platform.system() != "Windows":
models.append("urqmd34")
models.append("pythia8")
# for convenience, support building extra models via extra.cfg
# extra.cfg is not tracked by git, so can be freely modified
# extra.cfg example:
# -----
# sib23c00
# sib23c02
# sib23c03
# dev_dpmjetIII193=/full/path/to/dir/dpmjetIII-19.3
# ----
extra_cfg = cwd / "extra.cfg"
if extra_cfg.exists():
with open(extra_cfg) as f:
for model in f:
model = model.strip()
if model:
if "=" in model:
model = model.split("=")[0]
models.append(model)
ext_modules = []
for model in models:
ext_modules.append(CMakeExtension(f"impy.models._{model}"))
setup(
zip_safe=False,
ext_modules=ext_modules,
cmdclass={"build_ext": CMakeBuild},
)