5fedfe git_sort/lib: use correct class name for MutableSet

Authored and Committed by Qu Wenruo 2 years ago
    git_sort/lib: use correct class name for MutableSet
    
    [BUG]
    With latest python3.10, all git_sort scripts fails to start:
    
    $ ./scripts/git_sort/series_insert.py
    Traceback (most recent call last):
     File "~/btrfs/suse/kernel-source/./scripts/git_sort/series_insert.py", line 34, in <module>
       import lib
     File "~/btrfs/suse/kernel-source/scripts/git_sort/lib.py", line 569, in <module>
       class OrderedSet(collections.MutableSet):
    AttributeError: module 'collections' has no attribute 'MutableSet'
    
    [CAUSE]
    From python3.3 and later, MutableSet needs to be referred using
    "collections.abc.MutableSet", instead of just "collections.MutableSet".
    
    After python3.9, the old compatible behavior seems to be removed, thus
    causing above crash.
    
    [FIX]
    Try to import MutableSet from collections.abc first, if not found, then
    try again from collections.
    
    For v3.10 the first try should success, while on v3.4 I don't have any
    system to test though. Hopes this would work.
    
    Signed-off-by: Qu Wenruo <wqu@suse.com>
    
        
file modified
+6 -1