summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorParide Legovini <paride.legovini@canonical.com>2020-05-02 02:57:24 +0200
committerGitHub <noreply@github.com>2020-05-01 18:57:24 -0600
commit4d2684848722cb2d469ad4fa60999bf81cf7056e (patch)
tree2246e875479392fb7e38ee16bbe0815df7d89308 /Makefile
parent70dbccbbb27f7cc3f2decd692d41403f0d745c62 (diff)
downloadvyos-cloud-init-4d2684848722cb2d469ad4fa60999bf81cf7056e.tar.gz
vyos-cloud-init-4d2684848722cb2d469ad4fa60999bf81cf7056e.zip
Adapt the package building scripts to use Python 3 (#231)
Since upstream cloud-init has dropped python2 support, adapt remaining package build scripts and tools to python3 only Changes: * Do not template debian/rules as python3 is the only supported version * Drop six from requirements.txt * Makefile: drop everything related to Python 2 * run-container: install the CI deps only on ubuntu|debian * read-version: update the shebang to use Python 3 * brpm: read_dependencies(): drop unused argument * read-dependencies: switch to Py3 and drop the --python-version option * pkg-deps.json: drop the Python version field and update the redhat deps * pkg-deps.json: drop the unittest2 and contextlib2 renames * Update RPM the spec file to use Python 3 when building the RPM * bddeb: drop support for Python 2
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile54
1 files changed, 16 insertions, 38 deletions
diff --git a/Makefile b/Makefile
index 5f575633..5fb0fcbf 100644
--- a/Makefile
+++ b/Makefile
@@ -1,38 +1,22 @@
CWD=$(shell pwd)
-PYVER ?= $(shell for p in python3 python2; do \
- out=$$(command -v $$p 2>&1) && echo $$p && exit; done; exit 1)
YAML_FILES=$(shell find cloudinit tests tools -name "*.yaml" -type f )
YAML_FILES+=$(shell find doc/examples -name "cloud-config*.txt" -type f )
-PIP_INSTALL := pip install
-
-ifeq ($(PYVER),python3)
- pyflakes = pyflakes3
- unittests = unittest3
- yaml = yaml
-else
-ifeq ($(PYVER),python2)
- pyflakes = pyflakes
- unittests = unittest
-else
- pyflakes = pyflakes pyflakes3
- unittests = unittest unittest3
-endif
-endif
+PYTHON = python3
+PIP_INSTALL := pip3 install
ifeq ($(distro),)
distro = redhat
endif
-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())")
+READ_VERSION=$(shell $(PYTHON) $(CWD)/tools/read-version || echo read-version-failed)
+CODE_VERSION=$(shell $(PYTHON) -c "from cloudinit import version; print(version.version_string())")
all: check
-check: check_version test $(yaml)
+check: check_version test yaml
style-check: pep8 $(pyflakes)
@@ -42,20 +26,14 @@ pep8:
pyflakes:
@$(CWD)/tools/run-pyflakes
-pyflakes3:
- @$(CWD)/tools/run-pyflakes3
-
unittest: clean_pyc
- python -m pytest -v tests/unittests cloudinit
-
-unittest3: clean_pyc
python3 -m pytest -v tests/unittests cloudinit
ci-deps-ubuntu:
- @$(PYVER) $(CWD)/tools/read-dependencies --distro ubuntu --test-distro
+ @$(PYTHON) $(CWD)/tools/read-dependencies --distro ubuntu --test-distro
ci-deps-centos:
- @$(PYVER) $(CWD)/tools/read-dependencies --distro centos --test-distro
+ @$(PYTHON) $(CWD)/tools/read-dependencies --distro centos --test-distro
pip-requirements:
@echo "Installing cloud-init dependencies..."
@@ -65,7 +43,7 @@ pip-test-requirements:
@echo "Installing cloud-init test dependencies..."
$(PIP_INSTALL) -r "$@.txt" -q
-test: $(unittests)
+test: unittest
check_version:
@if [ "$(READ_VERSION)" != "$(CODE_VERSION)" ]; then \
@@ -74,7 +52,7 @@ check_version:
else true; fi
config/cloud.cfg:
- $(PYVER) ./tools/render-cloudcfg config/cloud.cfg.tmpl config/cloud.cfg
+ $(PYTHON) ./tools/render-cloudcfg config/cloud.cfg.tmpl config/cloud.cfg
clean_pyc:
@find . -type f -name "*.pyc" -delete
@@ -84,30 +62,30 @@ clean: clean_pyc
rm -rf doc/rtd_html .tox .coverage
yaml:
- @$(PYVER) $(CWD)/tools/validate-yaml.py $(YAML_FILES)
+ @$(PYTHON) $(CWD)/tools/validate-yaml.py $(YAML_FILES)
rpm:
- $(PYVER) ./packages/brpm --distro=$(distro)
+ $(PYTHON) ./packages/brpm --distro=$(distro)
srpm:
- $(PYVER) ./packages/brpm --srpm --distro=$(distro)
+ $(PYTHON) ./packages/brpm --srpm --distro=$(distro)
deb:
@which debuild || \
{ echo "Missing devscripts dependency. Install with:"; \
echo sudo apt-get install devscripts; exit 1; }
- $(PYVER) ./packages/bddeb
+ $(PYTHON) ./packages/bddeb
deb-src:
@which debuild || \
{ echo "Missing devscripts dependency. Install with:"; \
echo sudo apt-get install devscripts; exit 1; }
- $(PYVER) ./packages/bddeb -S -d
+ $(PYTHON) ./packages/bddeb -S -d
doc:
tox -e doc
-.PHONY: test pyflakes pyflakes3 clean pep8 rpm srpm deb deb-src yaml
+.PHONY: test pyflakes clean pep8 rpm srpm deb deb-src yaml
.PHONY: check_version pip-test-requirements pip-requirements clean_pyc
-.PHONY: unittest unittest3 style-check doc
+.PHONY: unittest style-check doc