summaryrefslogtreecommitdiffstats
path: root/testsuite/ext/ssl_protocols.py
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2015-07-28 17:55:17 +0200
committerAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2017-03-29 13:29:59 +0200
commit2e3ac3bd311ecf4d26032cd029dcc5e92170fe7f (patch)
tree15fb9398655a37ce0d16a41acb4a5b08ce2ddffa /testsuite/ext/ssl_protocols.py
parent97a113956f8211a2e718afe98a623cafebc03922 (diff)
downloadbcfg2-2e3ac3bd311ecf4d26032cd029dcc5e92170fe7f.tar.gz
bcfg2-2e3ac3bd311ecf4d26032cd029dcc5e92170fe7f.tar.bz2
bcfg2-2e3ac3bd311ecf4d26032cd029dcc5e92170fe7f.zip
testsuite: Support for ancient pylint versions
For Python2.4 and Python2.5 we need very old pylint versions (0.21.x). So we have to work around some bugs: - This adds some ugly monkey patching to backport some bugfixes from newer pylint versions (that does not support Python2.4 anymore). - Another problem is, that pylint-0.24 changed its message IDs. So this translates the new IDs into the older ones, so that the old pylint can match the disabled messages. - The newer version of pylint support more messages and some of the new messages have to be disabled. The old pylint versions have to silently ignore unknown message ids. - The compatible astng version of the old pylint does not support register_transformer, so we need to build out own variant by monkey patching the ASTNGBuilder.
Diffstat (limited to 'testsuite/ext/ssl_protocols.py')
-rw-r--r--testsuite/ext/ssl_protocols.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/testsuite/ext/ssl_protocols.py b/testsuite/ext/ssl_protocols.py
index 66068d2a9..a56293669 100644
--- a/testsuite/ext/ssl_protocols.py
+++ b/testsuite/ext/ssl_protocols.py
@@ -1,5 +1,5 @@
try:
- from logilab.astng import MANAGER, scoped_nodes, node_classes
+ from logilab.astng import MANAGER, builder, scoped_nodes, node_classes
PYLINT=0
except ImportError:
from astroid import MANAGER, scoped_nodes, node_classes
@@ -12,6 +12,14 @@ def ssl_transform(module):
def register(linter):
if PYLINT == 0:
- MANAGER.register_transformer(ssl_transform)
+ if hasattr(MANAGER, 'register_transformer'):
+ MANAGER.register_transformer(ssl_transform)
+ else:
+ safe = builder.ASTNGBuilder.string_build
+ def _string_build(self, data, modname='', path=None):
+ if modname == 'ssl':
+ data += '\n\nPROTOCOL_SSLv23 = 0\nPROTOCOL_TLSv1 = 0'
+ return safe(self, data, modname, path)
+ builder.ASTNGBuilder.string_build = _string_build
else:
MANAGER.register_transform(scoped_nodes.Module, ssl_transform)