From: Michael Jeanson Date: Thu, 26 Sep 2019 18:29:16 +0000 (-0400) Subject: jjb: babeltrace: pylint job for bt2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=af11423c1194469eaece9f550547b845720fbac9;p=lttng-ci.git jjb: babeltrace: pylint job for bt2 Signed-off-by: Michael Jeanson --- diff --git a/jobs/babeltrace.yaml b/jobs/babeltrace.yaml index b6e3e2d..cc80e2e 100644 --- a/jobs/babeltrace.yaml +++ b/jobs/babeltrace.yaml @@ -365,7 +365,7 @@ - 'gerrit' - job-template: - name: dev_gerrit_babeltrace_black + name: dev_gerrit_babeltrace_pylint defaults: babeltrace concurrent: true @@ -396,7 +396,7 @@ builders: - shell: - !include-raw-escape: scripts/babeltrace/black.sh + !include-raw-escape: scripts/babeltrace/pylint.sh properties: - inject: @@ -478,36 +478,17 @@ defaults: babeltrace node: 'amd64' - scm: [] - triggers: - pollscm: cron: "@daily" builders: - - copyartifact: - project: babeltrace_{version}_build/arch=amd64,build=std,conf=python-bindings - which-build: last-successful - stable: false - filter: 'build/**' - target: 'deps/babeltrace' - shell: !include-raw-escape: scripts/babeltrace/pylint.sh publishers: - archive: - artifacts: 'pep8.out,pylint.out' - - violations: - pep8: - pattern: pep8.out - min: 10 - max: 999 - unstable: 999 - pylint: - pattern: pylint.out - min: 10 - max: 999 - unstable: 999 + artifacts: 'black.out,flake8.out' - email-ext: recipients: '{obj:email_to}' reply-to: ci-notification@lists.lttng.org @@ -680,7 +661,6 @@ conf: !!python/tuple [std] - 'babeltrace_{version}_cppcheck' - 'babeltrace_{version}_scan-build' - - 'babeltrace_{version}_pylint' - project: name: babeltrace2 @@ -751,7 +731,7 @@ build: !!python/tuple [std] conf: !!python/tuple [std, prod] filter: '' - - 'dev_gerrit_babeltrace_black' + - 'dev_gerrit_babeltrace_pylint' - project: diff --git a/scripts/babeltrace/black.sh b/scripts/babeltrace/black.sh deleted file mode 100644 index 05cbfdb..0000000 --- a/scripts/babeltrace/black.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -exu -# -# Copyright (C) 2015 Michael Jeanson -# Copyright (C) 2019 Francis Deslauriers -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -PYTHON3=python3 - -PYENV_HOME="$WORKSPACE/.pyenv/" - -# Delete previously built virtualenv -if [ -d "$PYENV_HOME" ]; then - rm -rf "$PYENV_HOME" -fi - -# Create virtualenv and install necessary packages -virtualenv --system-site-packages -p ${PYTHON3} "$PYENV_HOME" - -set +ux -. "$PYENV_HOME/bin/activate" -set -ux - -pip install --quiet black - -black --diff --check src/babeltrace diff --git a/scripts/babeltrace/pylint.sh b/scripts/babeltrace/pylint.sh index dc3950c..35b287f 100755 --- a/scripts/babeltrace/pylint.sh +++ b/scripts/babeltrace/pylint.sh @@ -1,6 +1,7 @@ #!/bin/sh -exu # -# Copyright (C) 2015 - Michael Jeanson +# Copyright (C) 2019 Michael Jeanson +# Copyright (C) 2019 Francis Deslauriers # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,12 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -BABELTRACE_DIR="deps/babeltrace/build" - PYTHON3=python3 -P3_VERSION=$($PYTHON3 -c "import sys;print(sys.version[:3])") - -BINDINGS_DIR="$BABELTRACE_DIR/lib/python${P3_VERSION}/dist-packages/babeltrace" PYENV_HOME="$WORKSPACE/.pyenv/" @@ -32,13 +28,18 @@ fi # Create virtualenv and install necessary packages virtualenv --system-site-packages -p ${PYTHON3} "$PYENV_HOME" -set +u +set +ux . "$PYENV_HOME/bin/activate" -set -u +set -ux + +pip install --quiet black +pip install --quiet flake8 + +exit_code=0 -pip install --quiet pylint -pip install --quiet pep8 +cd src/babeltrace -pep8 --exclude="nativebt.py" "$BINDINGS_DIR" | tee pep8.out +black --diff --check . | tee ../../black.out || exit_code=1 +flake8 | tee ../../flake8.out || exit_code=1 -pylint -f parseable --ignore="nativebt.py" "$BINDINGS_DIR" | tee pylint.out +exit $exit_code