From 35c5f4a87162645384dde595c32e302d7f41f92b Mon Sep 17 00:00:00 2001
From: Dave Casper <dcasper@uci.edu>
Date: Sat, 13 Jun 2020 16:34:53 -0700
Subject: [PATCH] Minor edits for (future) Python 3 compatibility

---
 .../GeoModel/FaserGeoModel/python/DipoleGMConfig.py         | 2 +-
 .../GeoModel/FaserGeoModel/python/GeoModelConfig.py         | 2 +-
 .../GeoModel/FaserGeoModel/python/SCTGMConfig.py            | 2 +-
 .../GeoModel/FaserGeoModel/python/ScintGMConfig.py          | 2 +-
 .../GeoModel/FaserGeoModel/python/SetGeometryVersion.py     | 3 ++-
 .../FaserGeoModel/test/FaserGeometryConfig_EVNT_test.py     | 2 +-
 .../MagFieldServices/python/MagFieldServicesConfig.py       | 2 +-
 .../PreshowerGeoModel/test/PreshowerGMConfig_test.py        | 2 +-
 .../TriggerGeoModel/test/TriggerGMConfig_test.py            | 2 +-
 .../ScintDetDescr/VetoGeoModel/test/VetoGMConfig_test.py    | 2 +-
 .../PreshowerG4_SD/test/PreshowerG4_SDToolConfig_test.py    | 6 +++---
 .../TriggerG4_SD/test/TriggerG4_SDToolConfig_test.py        | 6 +++---
 .../ScintG4/VetoG4_SD/test/VetoG4_SDToolConfig_test.py      | 6 +++---
 Simulation/G4Faser/G4FaserAlg/test/runG4.py                 | 2 +-
 .../DipoleGeoModel/test/DipoleGMConfig_test.py              | 2 +-
 .../FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py        | 2 +-
 .../FaserSCT_G4_SD/test/FaserSCT_G4_SDToolConfig_test.py    | 6 +++---
 17 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/DetectorDescription/GeoModel/FaserGeoModel/python/DipoleGMConfig.py b/DetectorDescription/GeoModel/FaserGeoModel/python/DipoleGMConfig.py
index 6cd6b1a4..6593f728 100644
--- a/DetectorDescription/GeoModel/FaserGeoModel/python/DipoleGMConfig.py
+++ b/DetectorDescription/GeoModel/FaserGeoModel/python/DipoleGMConfig.py
@@ -52,7 +52,7 @@ if __name__ == "__main__":
   #acc.getService("StoreGateSvc").Dump=True
   acc.getService("ConditionStore").Dump=True
   acc.printConfig(withDetails=True)
-  f=open('DipoleGMCfg2.pkl','w')
+  f=open('DipoleGMCfg2.pkl','wb')
   acc.store(f)
   f.close()
   ConfigFlags.dump()
diff --git a/DetectorDescription/GeoModel/FaserGeoModel/python/GeoModelConfig.py b/DetectorDescription/GeoModel/FaserGeoModel/python/GeoModelConfig.py
index bda958b6..907eae5b 100644
--- a/DetectorDescription/GeoModel/FaserGeoModel/python/GeoModelConfig.py
+++ b/DetectorDescription/GeoModel/FaserGeoModel/python/GeoModelConfig.py
@@ -52,6 +52,6 @@ if __name__ == "__main__":
     ConfigFlags.lock()
 
     acc = GeoModelCfg( ConfigFlags )
-    acc.store( file( "test.pkl", "w" ), useBootStrapFile = False )
+    acc.store( open("test.pkl", "wb"), useBootStrapFile = False )
 
     print("All OK")
diff --git a/DetectorDescription/GeoModel/FaserGeoModel/python/SCTGMConfig.py b/DetectorDescription/GeoModel/FaserGeoModel/python/SCTGMConfig.py
index 8bc39143..cc8e5051 100644
--- a/DetectorDescription/GeoModel/FaserGeoModel/python/SCTGMConfig.py
+++ b/DetectorDescription/GeoModel/FaserGeoModel/python/SCTGMConfig.py
@@ -43,7 +43,7 @@ if __name__ == "__main__":
   #acc.getService("StoreGateSvc").Dump=True
   acc.getService("ConditionStore").Dump=True
   acc.printConfig(withDetails=True)
-  f=open('TrackerGMCfg2.pkl','w')
+  f=open('TrackerGMCfg2.pkl','wb')
   acc.store(f)
   f.close()
   ConfigFlags.dump()
diff --git a/DetectorDescription/GeoModel/FaserGeoModel/python/ScintGMConfig.py b/DetectorDescription/GeoModel/FaserGeoModel/python/ScintGMConfig.py
index 8e62384a..abc23011 100644
--- a/DetectorDescription/GeoModel/FaserGeoModel/python/ScintGMConfig.py
+++ b/DetectorDescription/GeoModel/FaserGeoModel/python/ScintGMConfig.py
@@ -52,7 +52,7 @@ if __name__ == "__main__":
   #acc.getService("StoreGateSvc").Dump=True
   acc.getService("ConditionStore").Dump=True
   acc.printConfig(withDetails=True)
-  f=open('ScintGMCfg2.pkl','w')
+  f=open('ScintGMCfg2.pkl','wb')
   acc.store(f)
   f.close()
   ConfigFlags.dump()
diff --git a/DetectorDescription/GeoModel/FaserGeoModel/python/SetGeometryVersion.py b/DetectorDescription/GeoModel/FaserGeoModel/python/SetGeometryVersion.py
index aeb522cc..5f8b4ebd 100644
--- a/DetectorDescription/GeoModel/FaserGeoModel/python/SetGeometryVersion.py
+++ b/DetectorDescription/GeoModel/FaserGeoModel/python/SetGeometryVersion.py
@@ -1,4 +1,5 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+from __future__ import print_function
 
 from AthenaCommon.JobProperties import jobproperties
 #from AthenaCommon.DetFlags    import DetFlags
@@ -20,5 +21,5 @@ relversion = rel_metadata['release'].split('.')
 if len(relversion) < 3:
     relversion = rel_metadata['base release'].split('.')
 
-print "SetGeometryVersion.py obtained major release version %s" % relversion[0]
+print("SetGeometryVersion.py obtained major release version ", relversion[0])
 GeoModelSvc.SupportedGeometry = int(relversion[0])
diff --git a/DetectorDescription/GeoModel/FaserGeoModel/test/FaserGeometryConfig_EVNT_test.py b/DetectorDescription/GeoModel/FaserGeoModel/test/FaserGeometryConfig_EVNT_test.py
index 6d48c59c..5563398d 100644
--- a/DetectorDescription/GeoModel/FaserGeoModel/test/FaserGeometryConfig_EVNT_test.py
+++ b/DetectorDescription/GeoModel/FaserGeoModel/test/FaserGeometryConfig_EVNT_test.py
@@ -48,7 +48,7 @@ if __name__ == "__main__":
     acc.foreach_component("*ClassID*").OutputLevel = INFO
     
     acc.printConfig(withDetails=True)
-    f=open('FaserGeoModelCfg_EVNT.pkl','w')
+    f=open('FaserGeoModelCfg_EVNT.pkl','wb')
     acc.store(f)
     f.close()
     ConfigFlags.dump()
diff --git a/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py b/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py
index aa5462ea..eea0f453 100644
--- a/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py
+++ b/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py
@@ -117,6 +117,6 @@ if __name__=="__main__":
 
 
           
-    f=open("MagneticFieldSvc.pkl","w")
+    f=open("MagneticFieldSvc.pkl","wb")
     cfg.store(f)
     f.close()
diff --git a/Scintillator/ScintDetDescr/PreshowerGeoModel/test/PreshowerGMConfig_test.py b/Scintillator/ScintDetDescr/PreshowerGeoModel/test/PreshowerGMConfig_test.py
index f25dc8fa..24a1ad21 100644
--- a/Scintillator/ScintDetDescr/PreshowerGeoModel/test/PreshowerGMConfig_test.py
+++ b/Scintillator/ScintDetDescr/PreshowerGeoModel/test/PreshowerGMConfig_test.py
@@ -20,6 +20,6 @@ if __name__ == "__main__":
     from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
     from PreshowerGeoModel.PreshowerGeoModelConfig import PreshowerGeometryCfg
     acc = PreshowerGeometryCfg(ConfigFlags)
-    f=open('PreshowerGeometryCfg.pkl','w')
+    f=open('PreshowerGeometryCfg.pkl','wb')
     acc.store(f)
     f.close()
diff --git a/Scintillator/ScintDetDescr/TriggerGeoModel/test/TriggerGMConfig_test.py b/Scintillator/ScintDetDescr/TriggerGeoModel/test/TriggerGMConfig_test.py
index c07c7af4..1a1a016c 100644
--- a/Scintillator/ScintDetDescr/TriggerGeoModel/test/TriggerGMConfig_test.py
+++ b/Scintillator/ScintDetDescr/TriggerGeoModel/test/TriggerGMConfig_test.py
@@ -20,6 +20,6 @@ if __name__ == "__main__":
     from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
     from TriggerGeoModel.TriggerGeoModelConfig import TriggerGeometryCfg
     acc = TriggerGeometryCfg(ConfigFlags)
-    f=open('TriggerGeometryCfg.pkl','w')
+    f=open('TriggerGeometryCfg.pkl','wb')
     acc.store(f)
     f.close()
diff --git a/Scintillator/ScintDetDescr/VetoGeoModel/test/VetoGMConfig_test.py b/Scintillator/ScintDetDescr/VetoGeoModel/test/VetoGMConfig_test.py
index ce28152d..a585cdec 100644
--- a/Scintillator/ScintDetDescr/VetoGeoModel/test/VetoGMConfig_test.py
+++ b/Scintillator/ScintDetDescr/VetoGeoModel/test/VetoGMConfig_test.py
@@ -20,6 +20,6 @@ if __name__ == "__main__":
     from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
     from VetoGeoModel.VetoGeoModelConfig import VetoGeometryCfg
     acc = VetoGeometryCfg(ConfigFlags)
-    f=open('VetoGeometryCfg.pkl','w')
+    f=open('VetoGeometryCfg.pkl','wb')
     acc.store(f)
     f.close()
diff --git a/Scintillator/ScintG4/PreshowerG4_SD/test/PreshowerG4_SDToolConfig_test.py b/Scintillator/ScintG4/PreshowerG4_SD/test/PreshowerG4_SDToolConfig_test.py
index 9f586ed1..e94aa49b 100644
--- a/Scintillator/ScintG4/PreshowerG4_SD/test/PreshowerG4_SDToolConfig_test.py
+++ b/Scintillator/ScintG4/PreshowerG4_SD/test/PreshowerG4_SDToolConfig_test.py
@@ -44,11 +44,11 @@ if __name__ == '__main__':
   cfg.printConfig(withDetails=True, summariseProps = True)
   ConfigFlags.dump()
 
-  f=open("test.pkl","w")
+  f=open("test.pkl","wb")
   cfg.store(f) 
   f.close()
 
 
 
-  print cfg._publicTools
-  print "-----------------finished----------------------"
+  print(cfg._publicTools)
+  print("-----------------finished----------------------")
diff --git a/Scintillator/ScintG4/TriggerG4_SD/test/TriggerG4_SDToolConfig_test.py b/Scintillator/ScintG4/TriggerG4_SD/test/TriggerG4_SDToolConfig_test.py
index 5c482eee..f983a561 100644
--- a/Scintillator/ScintG4/TriggerG4_SD/test/TriggerG4_SDToolConfig_test.py
+++ b/Scintillator/ScintG4/TriggerG4_SD/test/TriggerG4_SDToolConfig_test.py
@@ -44,11 +44,11 @@ if __name__ == '__main__':
   cfg.printConfig(withDetails=True, summariseProps = True)
   ConfigFlags.dump()
 
-  f=open("test.pkl","w")
+  f=open("test.pkl","wb")
   cfg.store(f) 
   f.close()
 
 
 
-  print cfg._publicTools
-  print "-----------------finished----------------------"
+  print (cfg._publicTools)
+  print ("-----------------finished----------------------")
diff --git a/Scintillator/ScintG4/VetoG4_SD/test/VetoG4_SDToolConfig_test.py b/Scintillator/ScintG4/VetoG4_SD/test/VetoG4_SDToolConfig_test.py
index 2eb4d3cb..5d361203 100644
--- a/Scintillator/ScintG4/VetoG4_SD/test/VetoG4_SDToolConfig_test.py
+++ b/Scintillator/ScintG4/VetoG4_SD/test/VetoG4_SDToolConfig_test.py
@@ -44,11 +44,11 @@ if __name__ == '__main__':
   cfg.printConfig(withDetails=True, summariseProps = True)
   ConfigFlags.dump()
 
-  f=open("test.pkl","w")
+  f=open("test.pkl","wb")
   cfg.store(f) 
   f.close()
 
 
 
-  print cfg._publicTools
-  print "-----------------finished----------------------"
+  print (cfg._publicTools)
+  print ("-----------------finished----------------------")
diff --git a/Simulation/G4Faser/G4FaserAlg/test/runG4.py b/Simulation/G4Faser/G4FaserAlg/test/runG4.py
index 23db5b96..3719fabd 100644
--- a/Simulation/G4Faser/G4FaserAlg/test/runG4.py
+++ b/Simulation/G4Faser/G4FaserAlg/test/runG4.py
@@ -128,7 +128,7 @@ if __name__ == "__main__":
 #    acc.getService("StoreGateSvc").Dump=True
 #    acc.getService("ConditionStore").Dump=True
 #    acc.printConfig()
-    f=open('FaserG4AppCfg_EVNT.pkl','w')
+    f=open('FaserG4AppCfg_EVNT.pkl','wb')
     acc.store(f)
     f.close()
 #
diff --git a/Tracker/TrackerDetDescr/DipoleGeoModel/test/DipoleGMConfig_test.py b/Tracker/TrackerDetDescr/DipoleGeoModel/test/DipoleGMConfig_test.py
index 251319ec..a20abc7e 100755
--- a/Tracker/TrackerDetDescr/DipoleGeoModel/test/DipoleGMConfig_test.py
+++ b/Tracker/TrackerDetDescr/DipoleGeoModel/test/DipoleGMConfig_test.py
@@ -18,6 +18,6 @@ if __name__ == "__main__":
     from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
     from DipoleGeoModel.DipoleGeoModelConfig import DipoleGeometryCfg
     acc = DipoleGeometryCfg(ConfigFlags)
-    f=open('DipoleGeometryCfg.pkl','w')
+    f=open('DipoleGeometryCfg.pkl','wb')
     acc.store(f)
     f.close()
diff --git a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py
index 15ccb863..cd8a4d62 100755
--- a/Tracker/TrackerDetDescr/FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py
+++ b/Tracker/TrackerDetDescr/FaserSCT_GeoModel/test/FaserSCT_GMConfig_test.py
@@ -18,6 +18,6 @@ if __name__ == "__main__":
     from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
     from FaserSCT_GeoModel.FaserSCT_GeoModelConfig import FaserSCT_GeometryCfg
     acc = FaserSCT_GeometryCfg(ConfigFlags)
-    f=open('FaserSCT_GeometryCfg.pkl','w')
+    f=open('FaserSCT_GeometryCfg.pkl','wb')
     acc.store(f)
     f.close()
diff --git a/Tracker/TrackerG4/FaserSCT_G4_SD/test/FaserSCT_G4_SDToolConfig_test.py b/Tracker/TrackerG4/FaserSCT_G4_SD/test/FaserSCT_G4_SDToolConfig_test.py
index 8107803f..394d3416 100644
--- a/Tracker/TrackerG4/FaserSCT_G4_SD/test/FaserSCT_G4_SDToolConfig_test.py
+++ b/Tracker/TrackerG4/FaserSCT_G4_SD/test/FaserSCT_G4_SDToolConfig_test.py
@@ -44,11 +44,11 @@ if __name__ == '__main__':
   cfg.printConfig(withDetails=True, summariseProps = True)
   ConfigFlags.dump()
 
-  f=open("test.pkl","w")
+  f=open("test.pkl","wb")
   cfg.store(f) 
   f.close()
 
 
 
-  print cfg._publicTools
-  print "-----------------finished----------------------"
+  print(cfg._publicTools)
+  print("-----------------finished----------------------")
-- 
GitLab