/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:
11
11
# "AvahiService" class, and some lines in "main".
12
12
#
13
13
# Everything else is
14
 
# Copyright © 2008-2020 Teddy Hogeborn
15
 
# Copyright © 2008-2020 Björn Påhlsson
 
14
# Copyright © 2008-2019 Teddy Hogeborn
 
15
# Copyright © 2008-2019 Björn Påhlsson
16
16
#
17
17
# This file is part of Mandos.
18
18
#
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
143
136
if sys.version_info < (3, 2):
144
137
    configparser.Configparser = configparser.SafeConfigParser
145
138
 
146
 
version = "1.8.12"
 
139
version = "1.8.9"
147
140
stored_state_file = "clients.pickle"
148
141
 
149
142
logger = logging.getLogger()
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