Merge pull request #146 from i386x/lsr-template-refactored--part-4

Onboard refactored tox & Travis CI setup and configuration vol. 4
This commit is contained in:
Till Maas 2020-01-16 17:19:28 +01:00 committed by GitHub
commit 7007a0ec1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 3 deletions

View file

@ -10,6 +10,12 @@
# Environment variables that not start with LSR_* but have influence on CI
# process:
#
# * .travis/runpylint.sh:
#
# - RUN_PYLINT_INCLUDE
# - RUN_PYLINT_EXCLUDE
# - RUN_PYLINT_DISABLED
#
# * .travis/runblack.sh:
#
# - RUN_BLACK_INCLUDE

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
#
# Copyright (c) 2019 Red Hat, Inc.
# Copyright (c) 2019-2020 Red Hat, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@ -24,7 +24,7 @@
"""
Probe directory tree for python files and pass them to pylint.
Usage: python run_pylint.py ARGUMENTS
Usage: python custom_pylint.py ARGUMENTS
Run pylint with ARGUMENTS followed by the list of python files contained in the
working directory and its subdirectories. As a python file is recognized a

29
.travis/runpylint.sh Executable file
View file

@ -0,0 +1,29 @@
#!/bin/bash
# SPDX-License-Identifier: MIT
# A shell wrapper around custom_pylint.py. The purpose of this wrapper is to
# set environment variables defined in config.sh before custom_pylint.py
# invocation, so user can control what should be pylinted via config.sh.
# Note: Prior this change, RUN_PYLINT_* environment variables set in config.sh
# take effect only when running inside Travis (because of runtox script
# which set them by including config.sh). Now, they take effect also when
# running tox locally.
# First argument to the script is a path to environment python, the rest of
# arguments are passed to custom_pylint.py.
set -e
ME=$(basename $0)
SCRIPTDIR=$(readlink -f $(dirname $0))
. ${SCRIPTDIR}/config.sh
# Sanitize path in case if running within tox (see
# https://github.com/tox-dev/tox/issues/1463):
ENVPYTHON=$(readlink -f $1)
shift
set -x
${ENVPYTHON} ${SCRIPTDIR}/custom_pylint.py "$@"

View file

@ -145,8 +145,10 @@ deps =
pylint>=1.8.4
ansible
-rpylint_extra_requirements.txt
whitelist_externals =
{[base]whitelist_externals}
commands =
{envpython} ./run_pylint.py --errors-only {posargs}
bash {toxinidir}/.travis/runpylint.sh {envpython} --errors-only {posargs}
[testenv:flake8]
envdir = {toxworkdir}/env-{env:TRAVIS_PYTHON_VERSION:2.7}