From 2c7a58e3371634e344fe8f73d226655298d0decc Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Tue, 24 May 2022 15:49:41 +0000
Subject: [PATCH] Resolve "Add required calibration/configuration artifacts to
 container"

---
 containers/jug/setup_detectors.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/containers/jug/setup_detectors.py b/containers/jug/setup_detectors.py
index 0ddfa02a3..08fd205fd 100755
--- a/containers/jug/setup_detectors.py
+++ b/containers/jug/setup_detectors.py
@@ -148,6 +148,16 @@ if __name__ == '__main__':
                             ip_version=ip['version'],
                             branch=branch),
                           file=f)
+                ## run once inside global prefix to initialize artifacts in /opt/detectors
+                os.environ['DETECTOR_PATH'] = args.prefix
+                cmd = f'bash -c \'cd {args.prefix} && source {prefix}/setup.sh && npdet_info print world_z {prefix}/share/{det}/{det}.xml\''
+                print(cmd)
+                os.system(cmd)
+                ## run once inside specific prefix to initialize artifacts in $DETECTOR_PATH
+                os.environ['DETECTOR_PATH'] = args.prefix
+                cmd = f'bash -c \'cd {prefix} && source {prefix}/setup.sh && npdet_info print world_z {prefix}/share/{det}/{det}.xml\''
+                print(cmd)
+                os.system(cmd)
     print(' --> Symlinking default detector for backward compatibility')
     full_prefix='{}/{}-{}'.format(args.prefix, default_detector, default_version)
     cmd = ['ln -sf {full_prefix}/share {short_prefix}',
-- 
GitLab