summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile11
-rw-r--r--cloudinit/cmd/devel/hotplug_hook.py3
-rwxr-xr-xcloudinit/distros/__init__.py2
-rw-r--r--cloudinit/sources/__init__.py2
-rw-r--r--cloudinit/stages.py2
-rwxr-xr-xsetup.py8
-rw-r--r--tests/integration_tests/clouds.py2
-rw-r--r--tests/integration_tests/instances.py4
-rwxr-xr-xtools/run-flake8 (renamed from tools/run-pyflakes)4
-rwxr-xr-xtools/run-pep821
-rw-r--r--tox.ini4
11 files changed, 23 insertions, 40 deletions
diff --git a/Makefile b/Makefile
index 5fb0fcbf..0c015dae 100644
--- a/Makefile
+++ b/Makefile
@@ -18,13 +18,10 @@ all: check
check: check_version test yaml
-style-check: pep8 $(pyflakes)
+style-check: flake8
-pep8:
- @$(CWD)/tools/run-pep8
-
-pyflakes:
- @$(CWD)/tools/run-pyflakes
+flake8:
+ @$(CWD)/tools/run-flake8
unittest: clean_pyc
python3 -m pytest -v tests/unittests cloudinit
@@ -86,6 +83,6 @@ deb-src:
doc:
tox -e doc
-.PHONY: test pyflakes clean pep8 rpm srpm deb deb-src yaml
+.PHONY: test flake8 clean rpm srpm deb deb-src yaml
.PHONY: check_version pip-test-requirements pip-requirements clean_pyc
.PHONY: unittest style-check doc
diff --git a/cloudinit/cmd/devel/hotplug_hook.py b/cloudinit/cmd/devel/hotplug_hook.py
index a0058f03..d4f0547e 100644
--- a/cloudinit/cmd/devel/hotplug_hook.py
+++ b/cloudinit/cmd/devel/hotplug_hook.py
@@ -13,7 +13,8 @@ from cloudinit.net import activators, read_sys_net_safe
from cloudinit.net.network_state import parse_net_config_data
from cloudinit.reporting import events
from cloudinit.stages import Init
-from cloudinit.sources import DataSource, DataSourceNotFoundException
+from cloudinit.sources import DataSource # noqa: F401
+from cloudinit.sources import DataSourceNotFoundException
LOG = log.getLogger(__name__)
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index a634623a..2e629143 100755
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -16,7 +16,7 @@ import stat
import string
import urllib.parse
from io import StringIO
-from typing import Any, Mapping
+from typing import Any, Mapping # noqa: F401
from cloudinit import importer
from cloudinit import log as logging
diff --git a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
index cc7e1c3c..54b8240a 100644
--- a/cloudinit/sources/__init__.py
+++ b/cloudinit/sources/__init__.py
@@ -13,7 +13,7 @@ import copy
import json
import os
from collections import namedtuple
-from typing import Dict, List
+from typing import Dict, List # noqa: F401
from cloudinit import dmi
from cloudinit import importer
diff --git a/cloudinit/stages.py b/cloudinit/stages.py
index bc164fa0..80aa9f5e 100644
--- a/cloudinit/stages.py
+++ b/cloudinit/stages.py
@@ -9,7 +9,7 @@ import os
import pickle
import sys
from collections import namedtuple
-from typing import Dict, Set
+from typing import Dict, Set # noqa: F401
from cloudinit.settings import (
FREQUENCIES, CLOUD_CONFIG, PER_INSTANCE, PER_ONCE, RUN_CLOUD_CONFIG)
diff --git a/setup.py b/setup.py
index 7fa03e63..100575ff 100755
--- a/setup.py
+++ b/setup.py
@@ -28,9 +28,11 @@ import subprocess
RENDERED_TMPD_PREFIX = "RENDERED_TEMPD"
VARIANT = None
+
def is_f(p):
return os.path.isfile(p)
+
def is_generator(p):
return '-generator' in p
@@ -111,6 +113,7 @@ def render_tmpl(template, mode=None):
# return path relative to setup.py
return os.path.join(os.path.basename(tmpd), bname)
+
# User can set the variant for template rendering
if '--distro' in sys.argv:
idx = sys.argv.index('--distro')
@@ -166,7 +169,7 @@ elif os.path.isfile('/etc/system-release-cpe'):
with open('/etc/system-release-cpe') as f:
cpe_data = f.read().rstrip().split(':')
- if cpe_data[1] == "\o":
+ if cpe_data[1] == "\o": # noqa: W605
# URI formated CPE
inc = 0
else:
@@ -216,7 +219,8 @@ class InitsysInstallData(install):
if self.init_system and isinstance(self.init_system, str):
self.init_system = self.init_system.split(",")
- if len(self.init_system) == 0 and not platform.system().endswith('BSD'):
+ if (len(self.init_system) == 0 and
+ not platform.system().endswith('BSD')):
self.init_system = ['systemd']
bad = [f for f in self.init_system if f not in INITSYS_TYPES]
diff --git a/tests/integration_tests/clouds.py b/tests/integration_tests/clouds.py
index f2362b5d..32fdc91e 100644
--- a/tests/integration_tests/clouds.py
+++ b/tests/integration_tests/clouds.py
@@ -28,7 +28,7 @@ from tests.integration_tests.instances import (
from tests.integration_tests.util import emit_dots_on_travis
try:
- from typing import Optional
+ from typing import Optional # noqa: F401
except ImportError:
pass
diff --git a/tests/integration_tests/instances.py b/tests/integration_tests/instances.py
index 055ec758..63e0e630 100644
--- a/tests/integration_tests/instances.py
+++ b/tests/integration_tests/instances.py
@@ -13,7 +13,9 @@ from tests.integration_tests import integration_settings
try:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
- from tests.integration_tests.clouds import IntegrationCloud
+ from tests.integration_tests.clouds import ( # noqa: F401
+ IntegrationCloud
+ )
except ImportError:
pass
diff --git a/tools/run-pyflakes b/tools/run-flake8
index 179afebe..0021cdb9 100755
--- a/tools/run-pyflakes
+++ b/tools/run-flake8
@@ -2,7 +2,7 @@
CR="
"
-pycheck_dirs=( "cloudinit/" "tests/" "tools/" )
+pycheck_dirs=( "cloudinit/" "tests/" "tools/" "setup.py" )
set -f
if [ $# -eq 0 ]; then
@@ -11,7 +11,7 @@ else
files=( "$@" )
fi
-cmd=( "python3" -m "pyflakes" "${files[@]}" )
+cmd=( "python3" -m "flake8" "${files[@]}" )
echo "Running: " "${cmd[@]}" 1>&2
exec "${cmd[@]}"
diff --git a/tools/run-pep8 b/tools/run-pep8
deleted file mode 100755
index 4bd0bbfb..00000000
--- a/tools/run-pep8
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-pycheck_dirs=( "cloudinit/" "tests/" "tools/" )
-
-CR="
-"
-[ "$1" = "-v" ] && { verbose="$1"; shift; } || verbose=""
-
-set -f
-if [ $# -eq 0 ]; then unset IFS
- IFS="$CR"
- files=( "${bin_files[@]}" "${pycheck_dirs[@]}" )
- unset IFS
-else
- files=( "$@" )
-fi
-
-myname=${0##*/}
-cmd=( "${myname#run-}" $verbose "${files[@]}" )
-echo "Running: " "${cmd[@]}" 1>&2
-exec "${cmd[@]}"
diff --git a/tox.ini b/tox.ini
index 27c16ef3..aad286ff 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,7 +13,7 @@ passenv=
basepython = python3
deps =
flake8==3.8.2
-commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/}
+commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/ setup.py}
# https://github.com/gabrielfalcao/HTTPretty/issues/223
setenv =
@@ -119,7 +119,7 @@ deps =
pytest==3.0.7
[testenv:tip-flake8]
-commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/}
+commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/ setup.py}
deps = flake8
[testenv:tip-pylint]