From fbd819b08a9204cbba1025248f6953afc5ad2016 Mon Sep 17 00:00:00 2001
From: scott snyder <sss@karma>
Date: Tue, 16 Jun 2020 15:23:22 +0200
Subject: [PATCH] AthenaConfiguration: Update for python 3.9 compatibility.

collections.Sequence is deprecated as of python 3.3, and removed in 3.9.
---
 .../AthenaConfiguration/python/AtlasSemantics.py    | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/Control/AthenaConfiguration/python/AtlasSemantics.py b/Control/AthenaConfiguration/python/AtlasSemantics.py
index 083f5f913907..6ae78fcf5041 100644
--- a/Control/AthenaConfiguration/python/AtlasSemantics.py
+++ b/Control/AthenaConfiguration/python/AtlasSemantics.py
@@ -7,6 +7,15 @@ import re
 import collections
 import copy
 
+# collections.Sequence is deprecated as of python 3.3.
+# As of 3.9, need to get it from collections.abc.
+# But that doesn't exist in py2.
+try:
+    from collections import abc
+    Sequence = abc.Sequence
+except ImportError:
+    Sequence = collections.Sequence
+
 class AppendListSemantics(GaudiConfig2.semantics.SequenceSemantics):
     '''
     Extend the sequence-semantics with a merge-method that appends the lists
@@ -106,7 +115,7 @@ class PublicHandleArraySemantics(GaudiConfig2.semantics.PropertySemantics):
         super(PublicHandleArraySemantics, self).__init__(cpp_type,name)
         
     def store(self, value):
-        if not isinstance(value,collections.Sequence) and not isinstance(value,set):
+        if not isinstance(value,Sequence) and not isinstance(value,set):
             value=[value,]
 
         newValue=[]
@@ -172,7 +181,7 @@ class SubAlgoSemantics(GaudiConfig2.semantics.PropertySemantics):
         super(SubAlgoSemantics, self).__init__(cpp_type,name)
         
     def store(self,value):
-        if not isinstance(value,collections.Sequence):
+        if not isinstance(value,Sequence):
             value=[value,]
         
         for v in value:
-- 
GitLab