File indexing completed on 2025-01-18 09:15:26
0001 import os
0002 from spack.package import *
0003
0004
0005 class Epic(CMakePackage):
0006 """The ePIC Detector at IP6 of the Electron-Ion Collider."""
0007
0008 homepage = "https://epic-eic.org"
0009 url = "https://github.com/eic/epic/archive/refs/tags/22.10.0.zip"
0010 list_url = "https://github.com/eic/epic/tags"
0011 git = "https://github.com/eic/epic"
0012
0013 maintainers = ["wdconinc"]
0014
0015 tags = ["eic"]
0016
0017 version("main", branch="main")
0018 version("25.01.1", sha256="393815f9a70bef775efa5f304cac4e7dc3be5eff284a2d45bb7e615ea87ad48c")
0019 version("25.01.0", sha256="af97f29df965dd5114c106e9291104b2c77e2dd758e04cae609d2e6c81561161")
0020 version("24.12.0", sha256="e7003a27bcb3f21763157ba12c9298113052249a4ccb49b5ba8a71a2f8612a12")
0021 version("24.11.2", sha256="0c734bec463103149acea641ce085c9653bc3b451a18f22c7c34aa632467f26f")
0022 version("24.11.1", sha256="781f848dc5032fc15699d57bcc911736d5fc22ac4b728a84da19fe7ee579a29f")
0023 version("24.11.0", sha256="3039d22bc654643046b27fc840543ec0faf35708c045f40f8f2c1064d1c6126d")
0024 version("24.10.1", sha256="9b5d161851d7acbe1986e7673bf8a268a9b74e1256fa3cb7e51a76e952990dcd")
0025 version("24.10.0", sha256="aeef27935f2664b96c1e0558b65dd2817ae53143c72de3451c24a9c65652c786")
0026 version("24.09.0", sha256="a0ab3ac4f5268aa2e5f7da0ab2e9c3c06180019bee088e1f72111e491fb8ae07")
0027 version("24.08.1", sha256="56f71b3136ade19a62ee6307f22a41a0cfade702519b0074799aee2aeecec8c8")
0028 version("24.08.0", sha256="288064ec68eb61a443a6b5ab5b8ec0b12b541ae1ad1550f4d68831390246dbb7")
0029 version("24.07.0", sha256="86f9a3f052e7a3699bba4e8f9f2600948073357bec820369a236dfe1339cf6f2")
0030 version("24.06.0", sha256="1aa075223704269905c6ac166ded074679387cbfda0297cfd4ec799e5b38a764")
0031 version("24.05.2", sha256="4e25154ca7c499eb360f370e0afac5c2d780cd2f682e0ad178875beb7db77040")
0032 version("24.05.1", sha256="2e0e7390fea6c091ee230835eac2354ac8b5f506f9508b4e6f8fd46d9573c2a5")
0033 version("24.05.0", sha256="647eff542ec5b77f73c2d9623d90abcca7a9ef30baaa21809b59f3c77e080385")
0034 version("24.04.0", sha256="9de5a71c3af9bf7d99ffcb10c5000d9ed2b5ffdbfc45a1a2e8b60cb73b480eea")
0035 version("24.03.1", sha256="58eb4fe340ba9e1b2d23bad805619b095ff0dc59d0187e831b576b1dbfb5cb24")
0036 version("24.03.0", sha256="d9943955a8135108df02ed4916c7493f246290c9379f912401efb3eecc297d4b")
0037 version("24.02.1", sha256="5c8bb108c00c807913da8508aa6a36d370079918e93f7cf6c8eae98fa41f43e7")
0038 version("24.02.0", sha256="04eb6e498eb6a9eafc2d29a5a34e6bbbedac26289ec98c5ce99cb5cfc3455d0e")
0039 version("23.12.0", sha256="04e94abf111d2746315dfa912f86c81c0f11011dff2a65434e00c87ba2de7b4a")
0040 version("23.11.0", sha256="24d856f718369d4336c56e191b5cb305bae60bcb06d00485154f5145d9acf597")
0041 version(
0042 "23.10.0",
0043 sha256="abf833eea328afb749c1eabbc83072c1382f02fc547ce7e9291e0616db552a0e",
0044 )
0045 version(
0046 "23.09.1",
0047 sha256="1fc30d36461e5acc3a54f475e9c01132aca12e74cc2fbec78fb3073fa83782b5",
0048 )
0049 version(
0050 "23.09.0",
0051 sha256="6f2ced07ead619ad4096246966383f7362d34fb140f8c0f3f60e775401deb303",
0052 )
0053 version(
0054 "23.08.0",
0055 sha256="1a8f82ef75d19dfad7228fcb437736622fc984caf0cf06466209124a8559d968",
0056 )
0057 version(
0058 "23.07.2",
0059 sha256="e80c31a338e41766aecc76441ac7aed7d53ddf401c7ca8773b0124536096ef2d",
0060 )
0061 version(
0062 "23.07.1",
0063 sha256="7e5908b3a64941ca2ff81195d62b3da6c8a20c4431f903a3c1bdda30bd39fac3",
0064 )
0065 version(
0066 "23.07.0",
0067 sha256="3b2fd83ee1664cb6bb47e45098c0357649d33526bac1e8637118bec4cd88295e",
0068 )
0069 version(
0070 "23.06.1",
0071 sha256="c78a756f84f34c6bb7b39e2bb104ffa7bcb2c7d0dcbdaa7905fe44f81e7b17aa",
0072 )
0073 version(
0074 "23.06.0",
0075 sha256="3e9825457920b97cab1bc73f44b8cfc45130f66a5d00c4acde4f8b9079a661b1",
0076 )
0077 version(
0078 "23.05.2",
0079 sha256="afb31d076a7859bd4cd94d9eed237f402a5cc56100c53c933ed4a024c8ef997b",
0080 )
0081 version(
0082 "23.05.1",
0083 sha256="4cac31b2619b3aafaaa9cc6a43923a97d04d74b753eb580990d569d1ef94c94d",
0084 )
0085 version(
0086 "23.05.0",
0087 sha256="a72774ffc3176178b128a4069d2a7bebfebde91192d971d0ccd3ab3392ff7977",
0088 )
0089 version(
0090 "23.03.0",
0091 sha256="16badb2418531250a81931f920e145c4be9ef93411f091d93202c23e36e91129",
0092 )
0093 version(
0094 "23.01.0",
0095 sha256="56e1d9a9ca3d81e64127f4d14fd45733dad07f6ffdec8387e6cae5e729525399",
0096 )
0097 version(
0098 "22.12.0",
0099 sha256="9de036b47ab8d0c97ab32fc788dd8300132014413013a1b19c2a3f8f3883a7ae",
0100 )
0101 version(
0102 "22.11.3",
0103 sha256="5cea46de7edf4868a361c5a75749f6c0f3d3ee941a33b956b2507581aa638232",
0104 )
0105 version(
0106 "22.11.2",
0107 sha256="f53aa7a4d992ddfb7549abedd4d6b87d61569b9530691b99640c6a635f2545c2",
0108 )
0109 version(
0110 "22.11.1",
0111 sha256="c8aded71dc707185a06557a76060661c57f24ed5eeb4a39b0ebcc63c9fc0a4fe",
0112 )
0113 version(
0114 "22.11.0",
0115 sha256="f683ed9e26b303ea428dc513d6e841efeeaa584cec44121f6a28116693d13065",
0116 )
0117 version(
0118 "22.10.1",
0119 sha256="dbd70d2d5ab42f3979ba4e7cda87cbb8cc48b37c4d13a887bbf96c3b32c347e9",
0120 )
0121 version(
0122 "22.10.0",
0123 sha256="f683ed9e26b303ea428dc513d6e841efeeaa584cec44121f6a28116693d13065",
0124 )
0125
0126 def cmake_flags(self):
0127 return [f"-DVERSION={self.version}"]
0128
0129
0130 patch(
0131 "https://github.com/eic/epic/pull/449.patch?full_index=1",
0132 sha256="df951c3e8a6dd519b48ae7b6248dc70e9709e3931f129cba66cafed2466837f4",
0133 when="@:23.06 ^dd4hep@1.26:",
0134 )
0135
0136 patch(
0137 "https://github.com/eic/epic/pull/520.patch?full_index=1",
0138 sha256="b76a5830404c4e25efc95f359dc661c29de417b1961525ac3cfd76f954ee3957",
0139 when="@:23.09",
0140 )
0141
0142 variant(
0143 "artifacts",
0144 default="none",
0145 description="Initialize configuration with artifacts",
0146 )
0147 variant(
0148 "ip",
0149 default="6",
0150 values=("6"),
0151 when="@:22.11",
0152 description="Interaction point design",
0153 )
0154
0155 depends_on("cxx", type="build")
0156
0157 depends_on("dd4hep@1.21: +ddg4 +ddrec", when="@:23.03.0")
0158 depends_on("dd4hep@1.21: +ddrec", when="@23.05.0:")
0159
0160 depends_on("acts-dd4hep", when="@:23.01.0")
0161
0162 depends_on("fmt +shared")
0163 depends_on("py-pyyaml")
0164 depends_on("py-jinja2")
0165
0166 depends_on("eic-ip6", when="@:22.11 ip=6")
0167
0168 phases = ["cmake", "build", "install", "postinstall"]
0169
0170 def postinstall(self, spec, prefix):
0171 if spec.satisfies("@:22.11"):
0172 ip = "ip" + spec.variants["ip"].value
0173
0174
0175
0176
0177
0178 copy_tree(
0179 join_path(self.spec["eic-" + ip].prefix, "share", ip, ip),
0180 join_path(prefix, "share/epic", ip),
0181 )
0182
0183 if not spec.satisfies("artifacts=none"):
0184 detector_path = join_path(self.prefix.share, "epic")
0185 with working_dir(detector_path):
0186 os.environ["LD_LIBRARY_PATH"] += os.pathsep + self.prefix.lib
0187 if spec.satisfies("@:24.03"):
0188 os.environ["LD_LIBRARY_PATH"] += os.pathsep + self.spec["root"].prefix.lib.root
0189 os.environ["LD_LIBRARY_PATH"] += os.pathsep + self.spec["fmt"].prefix.lib
0190 os.environ["DETECTOR_PATH"] = detector_path
0191 checkGeometry = Executable(join_path(spec['dd4hep'].prefix.bin, 'checkGeometry'))
0192 checkGeometry('-c', join_path(detector_path, spec.variants["artifacts"].value + ".xml"))
0193
0194 def setup_run_environment(self, env):
0195 env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib)
0196 env.set("DETECTOR_PATH", join_path(self.prefix.share, "epic"))
0197 env.set("DETECTOR", "epic")
0198 env.set("DETECTOR_CONFIG", "epic")