From e9dc2ddd51b2d3de8d839fa3cf4259231b6e2245 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 2 Apr 2014 19:53:53 -0400 Subject: [PATCH 1/3] jenkins-build: make pylint handle the hashlib hash classes properly hashlib uses some magic to load whatever is built into the local openssl. pylint gets confused by this, so we need a pylint plugin to trick pylint into thinking everything is good. --- .pylint-plugins/astng_hashlib.py | 39 ++++++++++++++++++++++++++++++++ jenkins-build | 10 ++++---- 2 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 .pylint-plugins/astng_hashlib.py diff --git a/.pylint-plugins/astng_hashlib.py b/.pylint-plugins/astng_hashlib.py new file mode 100644 index 00000000..f4b7871c --- /dev/null +++ b/.pylint-plugins/astng_hashlib.py @@ -0,0 +1,39 @@ +# +# started from http://www.logilab.org/blogentry/78354 +# + +from logilab.astng import MANAGER +from logilab.astng.builder import ASTNGBuilder + +def hashlib_transform(module): + if module.name == 'hashlib': + fake = ASTNGBuilder(MANAGER).string_build(''' + +class fakehash(object): + digest_size = -1 + def __init__(self, value): pass + def digest(self): + return u'' + def hexdigest(self): + return u'' + def update(self, value): pass + +class md5(fakehash): + pass + +class sha1(fakehash): + pass + +class sha256(fakehash): + pass + +''') + for hashfunc in ('sha256', 'sha1', 'md5'): + module.locals[hashfunc] = fake.locals[hashfunc] + +def register(linter): + """called when loaded by pylint --load-plugins, register our tranformation + function here + """ + MANAGER.register_transformer(hashlib_transform) + diff --git a/jenkins-build b/jenkins-build index 281aa1d4..7decda4b 100755 --- a/jenkins-build +++ b/jenkins-build @@ -72,13 +72,11 @@ pyflakes fdroid makebuildserver fdroidserver/*.py setup.py cd $WORKSPACE set +e -# disable E1101 until there is a plugin to handle this properly: -# Module 'sys' has no '_MEIPASS' member -# disable F0401 until there is a plugin to handle this properly: -# keysync-gui:25: [F] Unable to import 'ordereddict' # use the virtualenv python so pylint checks against its installed libs -python /usr/bin/pylint --output-format=parseable --reports=n \ - fdroidserver/*.py fdroid makebuildserver setup.py > $WORKSPACE/pylint.parseable + PYTHONPATH=$WORKSPACE/.pylint-plugins python /usr/bin/pylint \ + --output-format=parseable --reports=n \ + --load-plugins astng_hashlib \ + fdroidserver/*.py fdroid makebuildserver setup.py > $WORKSPACE/pylint.parseable # to only tell jenkins there was an error if we got ERROR or FATAL, uncomment these: [ $(($? & 1)) = "1" ] && echo "FATALs found" From 5ee4f3d72d772f95c992042becf12adf3a77987b Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 3 Apr 2014 11:54:08 -0400 Subject: [PATCH 2/3] enable Jenkins reporting of pylint errors and warnings fatals still can not be enabled because of a bug in pylint when running in a virtualenv: https://bitbucket.org/logilab/pylint/issue/73/pylint-is-unable-to-import running pylint in the virtualenv would not be needed once mwclient is packaged for Debian and installed that way. --- jenkins-build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jenkins-build b/jenkins-build index 7decda4b..81639626 100755 --- a/jenkins-build +++ b/jenkins-build @@ -79,8 +79,10 @@ set +e fdroidserver/*.py fdroid makebuildserver setup.py > $WORKSPACE/pylint.parseable # to only tell jenkins there was an error if we got ERROR or FATAL, uncomment these: +# running pylint in the virtualenv is causing this FATAL error, which is a bug: +# https://bitbucket.org/logilab/pylint/issue/73/pylint-is-unable-to-import [ $(($? & 1)) = "1" ] && echo "FATALs found" -[ $(($? & 2)) = "2" ] && echo "ERRORs found" -[ $(($? & 4)) = "4" ] && echo "WARNINGs found" +[ $(($? & 2)) = "2" ] && exit 2 +[ $(($? & 4)) = "4" ] && exit 4 set -e From 947a6d57d25dd4418f871b8b60330140b7c4f0d9 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 3 Apr 2014 12:34:01 -0400 Subject: [PATCH 3/3] 'ssh' python module no longer needed, only 'paramiko' --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 9c771d30..3bfea041 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,6 @@ setup(name='fdroidserver', 'paramiko', 'PIL', 'python-magic', - 'ssh', ], classifiers=[ 'Development Status :: 3 - Alpha',