File tree Expand file tree Collapse file tree 5 files changed +44
-7
lines changed Expand file tree Collapse file tree 5 files changed +44
-7
lines changed Original file line number Diff line number Diff line change 3030
3131 steps :
3232 - name : Install required PyPI packages
33- run : ${{ matrix.pip-command }} install "ansible-lint>=6.0.0,<7.0.0"
33+ run : ${{ matrix.pip-command }} install ansible-lint pylint mock paramiko psycopg2-binary websockify websocket-client looseversion isort pycodestyle pyflakes
34+
35+ - name : Ensure required packages are available for linting
36+ run : dnf -y install otopi python3-ovirt-setup-lib python3-daemon
3437
3538 - name : Checkout sources
3639 uses : ovirt/checkout-action@main
3942 run : |
4043 .automation/build-rpm.sh $ARTIFACTS_DIR
4144
45+ - name : Run python check
46+ run : build/python-check.sh
47+
4248 - name : Create DNF repository
4349 run : |
4450 createrepo_c $ARTIFACTS_DIR
Original file line number Diff line number Diff line change 1+ [MASTER]
2+ init-hook =
3+ import sys, pathlib;
4+ root = pathlib.Path().resolve();
5+ paths = [
6+ root / " packaging" / " pythonlib" ,
7+ root / " packaging" / " services" / " ovirt-engine" ,
8+ root / " packaging" / " services" / " ovirt-fence-kdump-listener" ,
9+ root / " packaging" / " services" / " ovirt-websocket-proxy" ,
10+ root / " packaging" / " services" / " ovirt-engine-notifier" ,
11+ root / " packaging" / " libexec" / " ovirt-vmconsole-proxy-helper"
12+ ];
13+ [sys.path.insert(0, str(p)) for p in paths if str(p) not in sys.path]
Original file line number Diff line number Diff line change @@ -23,7 +23,10 @@ RUN make ovirt-engine.spec
2323RUN dnf -y builddep ovirt-engine.spec
2424
2525# Install run deps
26- RUN dnf -y install python3-daemon python3-otopi python3-psycopg2 python3-ovirt-setup-lib otopi-common initscripts-service bind-utils postgresql ovirt-engine-wildfly-overlay mailcap ansible-runner ansible-collection-ansible-posix ovirt-imageio-daemon novnc ovirt-engine-websocket-proxy
26+ RUN dnf -y install python3-daemon python3-otopi python3-psycopg2 python3-ovirt-setup-lib otopi-common initscripts-service bind-utils postgresql ovirt-engine-wildfly-overlay mailcap ansible-runner ansible-collection-ansible-posix ovirt-imageio-daemon novnc ovirt-engine-websocket-proxy python3-pip
27+
28+ # Install linting tools
29+ RUN pip install pylint pyflakes isort pycodestyle mock
2730
2831# engine-setup needs the link to initctl
2932RUN ln -s /usr/sbin/service /usr/bin/initctl
Original file line number Diff line number Diff line change @@ -30,10 +30,11 @@ PACKAGE_NAME=ovirt-engine
3030ENGINE_NAME =$(PACKAGE_NAME )
3131MVN =mvn
3232PYTHON =$(shell which python3 2> /dev/null)
33- PYFLAKES =$( shell which pyflakes 2> /dev/null)
33+ PYFLAKES =pyflakes
3434PY_VERSION =3
35- PEP8 =$( shell which pycodestyle-3 2> /dev/null)
35+ PEP8 =pycodestyle
3636ISORT =isort
37+ PYLINT =pylint
3738PREFIX? =/usr/local
3839LOCALSTATE_DIR =$(PREFIX ) /var
3940BIN_DIR =$(PREFIX ) /bin
@@ -184,6 +185,7 @@ BUILD_TARGET=install
184185 -e " s|@PEP8@|$( PEP8) |g" \
185186 -e " s|@PYFLAKES@|$( PYFLAKES) |g" \
186187 -e " s|@ISORT@|$( ISORT) |g" \
188+ -e " s|@PYLINT@|$( PYLINT) |g" \
187189 -e " s|@DEVMODE@|$( BUILD_DEV) |g" \
188190 -e " s|@VMCONSOLE_SYSCONF_DIR@|$( VMCONSOLE_SYSCONF_DIR) |g" \
189191 -e " s|@VMCONSOLE_PKI_DIR@|$( VMCONSOLE_PKI_DIR) |g" \
Original file line number Diff line number Diff line change 1- #! /bin/sh -x
1+ #! /bin/sh
22
33PEP8=" @PEP8@"
44PYFLAKES=" @PYFLAKES@"
55ISORT=" @ISORT@"
6+ PYLINT=" @PYLINT@"
67SRCDIR=" $( dirname " $0 " ) /.."
78
89cd " ${SRCDIR} "
@@ -19,7 +20,7 @@ for exe in "${PYFLAKES}" "${PEP8}"; do
1920 echo " WARNING: tool '${exe} ' is missing" >&2
2021 else
2122 if " ${exe} " ${FILES} ; then
22- echo Passed check: " ${exe} " ${FILES}
23+ echo Passed check: " ${exe} "
2324 else
2425 echo ERROR: The following check failed:
2526 echo " ${exe} " ${FILES}
@@ -28,11 +29,23 @@ for exe in "${PYFLAKES}" "${PEP8}"; do
2829 fi
2930done
3031
32+ if ! which " ${PYLINT} " > /dev/null 2>&1 ; then
33+ echo " WARNING: Pylint is missing" >&2
34+ else
35+ if " ${PYLINT} " --errors-only ${FILES} ; then
36+ echo Passed check: " ${PYLINT} " --errors-only
37+ else
38+ echo ERROR: The following check failed:
39+ echo python3 -m " ${PYLINT} " --errors-only ${FILES}
40+ ret=1
41+ fi
42+ fi
43+
3144if ! which " ${ISORT} " > /dev/null 2>&1 ; then
3245 echo " WARNING: tool '${ISORT} ' is missing" >&2
3346else
3447 if " ${ISORT} " --check ${FILES} ; then
35- echo Passed check: " ${ISORT} " --check ${FILES}
48+ echo Passed check: " ${ISORT} " --check
3649 else
3750 echo ERROR: The following check failed:
3851 echo " ${ISORT} " --check ${FILES}
You can’t perform that action at this time.
0 commit comments