From e55ff8f8ea9abeb7c406b2eec3e91aad8fee6f64 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 11 Jan 2017 16:20:10 -0500 Subject: validate-yaml: use python rather than explicitly python3 The change here is to use '/usr/bin/env python' in validate-yaml.py as all other tools/*.py do. Additionally, change the Makefile to invoke validate-yaml.py with the python that it has selected for other things (PYVER). --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5d35dcc0..ed631cf7 100644 --- a/Makefile +++ b/Makefile @@ -73,7 +73,7 @@ clean: clean_pyc rm -rf /var/log/cloud-init.log /var/lib/cloud/ yaml: - @$(CWD)/tools/validate-yaml.py $(YAML_FILES) + @$(PYVER) $(CWD)/tools/validate-yaml.py $(YAML_FILES) rpm: ./packages/brpm --distro $(distro) -- cgit v1.2.3 From a3376d45c83e90150d8de79a2b31282a7d760bd7 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 20 Jan 2017 09:36:51 -0500 Subject: build: fix running Make on a branch with tags other than master running 'make' on a git branch other than master would fail with complaint that the tools/read-version reported a different version than the code. Change to only consider tags starting with 0-9 in read-version. --- Makefile | 7 ++++--- tools/make-tarball | 2 +- tools/read-version | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ed631cf7..18ec5680 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,8 @@ ifeq ($(distro),) distro = redhat endif -READ_VERSION=$(shell $(PYVER) $(CWD)/tools/read-version) +READ_VERSION=$(shell $(PYVER) $(CWD)/tools/read-version || \ + echo read-version-failed) CODE_VERSION=$(shell $(PYVER) -c "from cloudinit import version; print(version.version_string())") @@ -62,8 +63,8 @@ test: $(unittests) check_version: @if [ "$(READ_VERSION)" != "$(CODE_VERSION)" ]; then \ - echo "Error: read-version version $(READ_VERSION)" \ - "not equal to code version $(CODE_VERSION)"; exit 2; \ + echo "Error: read-version version '$(READ_VERSION)'" \ + "not equal to code version '$(CODE_VERSION)'"; exit 2; \ else true; fi clean_pyc: diff --git a/tools/make-tarball b/tools/make-tarball index c150dd2f..91c45624 100755 --- a/tools/make-tarball +++ b/tools/make-tarball @@ -35,7 +35,7 @@ while [ $# -ne 0 ]; do done rev=${1:-HEAD} -version=$(git describe ${long_opt} $rev) +version=$(git describe "--match=[0-9]*" ${long_opt} $rev) archive_base="cloud-init-$version" if [ -z "$output" ]; then diff --git a/tools/read-version b/tools/read-version index 3b30b497..ddb28383 100755 --- a/tools/read-version +++ b/tools/read-version @@ -56,7 +56,7 @@ if os.path.isdir(os.path.join(_tdir, ".git")) and which("git"): flags = [] if use_tags: flags = ['--tags'] - cmd = ['git', 'describe'] + flags + cmd = ['git', 'describe', '--match=[0-9]*'] + flags version = tiny_p(cmd).strip() -- cgit v1.2.3 From 3bcb72c593f13915a81272778809dd8e71e2c7b7 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Mon, 30 Jan 2017 11:24:45 -0700 Subject: Remove style checking during build and add latest style checks to tox - make check will no longer run the style checks, that way package builds wont fail on a style difference in versions of the style tools in that distro. - created style-check make file target to continue to run pep8 and pyflakes - added tox envs 'tip-pycodestyle' and 'tip-pyflakes' to run latest style checking. These are not enabled by default run of tox. LP: #1652329 --- Makefile | 5 ++++- tox.ini | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 18ec5680..5940ed7e 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,9 @@ CODE_VERSION=$(shell $(PYVER) -c "from cloudinit import version; print(version.v all: check -check: check_version pep8 $(pyflakes) test $(yaml) +check: check_version test $(yaml) + +style-check: pep8 $(pyflakes) pep8: @$(CWD)/tools/run-pep8 @@ -84,3 +86,4 @@ deb: .PHONY: test pyflakes pyflakes3 clean pep8 rpm deb yaml check_version .PHONY: pip-test-requirements pip-requirements clean_pyc unittest unittest3 +.PHONY: style-check diff --git a/tox.ini b/tox.ini index e79ea6aa..ca5d8b87 100644 --- a/tox.ini +++ b/tox.ini @@ -79,3 +79,11 @@ deps = jsonpatch==1.2 six==1.9.0 -r{toxinidir}/test-requirements.txt + +[testenv:tip-pycodestyle] +commands = {envpython} -m pycodestyle {posargs:cloudinit/ tests/ tools/} +deps = pycodestyle + +[testenv:tip-pyflakes] +commands = {envpython} -m pyflakes {posargs:cloudinit/ tests/ tools/} +deps = pyflakes -- cgit v1.2.3