/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2020-02-06 15:56:51 UTC
  • Revision ID: teddy@recompile.se-20200206155651-kx7r39zj8hpv8udl
Use collections.abc.Callable instead of collections.Callable

In Python 3.7, collections.Callable (among others) was moved to
collections.abc.Callable, and its old location deprecated.

* mandos: Create "collections.abc.Callable" if it does not exist, and
  only use the new name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
import codecs
80
80
import unittest
81
81
import random
82
 
import shlex
83
82
 
84
83
import dbus
85
84
import dbus.service
104
103
    collections.abc = abc
105
104
    del abc
106
105
 
107
 
# Add shlex.quote if it does not exist
108
 
try:
109
 
    shlex.quote
110
 
except AttributeError:
111
 
    shlex.quote = re.escape
112
 
 
113
106
# Show warnings by default
114
107
if not sys.warnoptions:
115
108
    import warnings
1134
1127
        if self.checker is None:
1135
1128
            # Escape attributes for the shell
1136
1129
            escaped_attrs = {
1137
 
                attr: shlex.quote(str(getattr(self, attr)))
 
1130
                attr: re.escape(str(getattr(self, attr)))
1138
1131
                for attr in self.runtime_expansions}
1139
1132
            try:
1140
1133
                command = self.checker_command % escaped_attrs