From 627569b6caead280101e2017f1bf7830ed8a5f6d Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 23 Oct 2018 18:25:27 +0200 Subject: [PATCH 1/8] Add a Make target / test which verifies st2client installs and works fine. --- Makefile | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a510f49a23..7f6a07aec4 100644 --- a/Makefile +++ b/Makefile @@ -2,13 +2,17 @@ ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) SHELL := /bin/bash TOX_DIR := .tox OS := $(shell uname) + # We separate the OSX X and Linux virtualenvs so we can run in a Docker # container (st2devbox) while doing things on our host Mac machine ifeq ($(OS),Darwin) VIRTUALENV_DIR ?= virtualenv-osx + VIRTUALENV_ST2CLIENT_DIR ?= virtualenv-st2client-osx else VIRTUALENV_DIR ?= virtualenv + VIRTUALENV_ST2CLIENT_DIR ?= virtualenv-st2client endif + PYTHON_VERSION = python2.7 BINARIES := bin @@ -232,6 +236,31 @@ flake8: requirements .flake8 . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 tools/ . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 pylint_plugins/ +# Make task which verifies st2client installs and works fine +.PHONY: .st2client-install-check +.st2client-install-check: + @echo + @echo "==================== st2client install check ====================" + @echo + test -f $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate || virtualenv --python=$(PYTHON_VERSION) --no-site-packages $(VIRTUALENV_ST2CLIENT_DIR) --no-download + + # Setup PYTHONPATH in bash activate script... + # Delete existing entries (if any) + sed -i '/_OLD_PYTHONPATHp/d' $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate + sed -i '/PYTHONPATH=/d' $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate + sed -i '/export PYTHONPATH/d' $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate + + echo '_OLD_PYTHONPATH=$$PYTHONPATH' >> $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate + echo 'PYTHONPATH=${ROOT_DIR}:$(COMPONENT_PYTHONPATH)' >> $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate + echo 'export PYTHONPATH' >> $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate + touch $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate + chmod +x $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate + + $(VIRTUALENV_ST2CLIENT_DIR)/bin/pip install --upgrade "pip>=9.0,<9.1" + $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate; cd st2client ; python setup.py install ; cd .. + $(VIRTUALENV_ST2CLIENT_DIR)/bin/st2 --version + $(VIRTUALENV_ST2CLIENT_DIR)/bin/python -c "import st2client" + .PHONY: bandit bandit: requirements .bandit @@ -246,7 +275,7 @@ bandit: requirements .bandit lint: requirements .lint .PHONY: .lint -.lint: .generate-api-spec .flake8 .pylint .bandit .st2client-dependencies-check .st2common-circular-dependencies-check .rst-check +.lint: .generate-api-spec .flake8 .pylint .bandit .st2client-dependencies-check .st2common-circular-dependencies-check .rst-check .st2client-install-check .PHONY: clean clean: .cleanpycs From 4cd267a8981b190143ee35417703d274694a0563 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 23 Oct 2018 18:56:36 +0200 Subject: [PATCH 2/8] Only run st2client install check on ci. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7f6a07aec4..b5e6d48308 100644 --- a/Makefile +++ b/Makefile @@ -275,7 +275,7 @@ bandit: requirements .bandit lint: requirements .lint .PHONY: .lint -.lint: .generate-api-spec .flake8 .pylint .bandit .st2client-dependencies-check .st2common-circular-dependencies-check .rst-check .st2client-install-check +.lint: .generate-api-spec .flake8 .pylint .bandit .st2client-dependencies-check .st2common-circular-dependencies-check .rst-check .PHONY: clean clean: .cleanpycs @@ -817,7 +817,7 @@ debs: ci: ci-checks ci-unit ci-integration ci-mistral ci-packs-tests .PHONY: ci-checks -ci-checks: compile .generated-files-check .pylint .flake8 .bandit .st2client-dependencies-check .st2common-circular-dependencies-check circle-lint-api-spec .rst-check +ci-checks: compile .generated-files-check .pylint .flake8 .bandit .st2client-dependencies-check .st2common-circular-dependencies-check circle-lint-api-spec .rst-check .st2client-install-check .PHONY: ci-py3-unit ci-py3-unit: From 9cb48d981a2809d401be077fe74be449b3b80371 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 23 Oct 2018 20:26:10 +0200 Subject: [PATCH 3/8] Use Python binary from venv dir. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b5e6d48308..30e56dee05 100644 --- a/Makefile +++ b/Makefile @@ -257,7 +257,7 @@ flake8: requirements .flake8 chmod +x $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate $(VIRTUALENV_ST2CLIENT_DIR)/bin/pip install --upgrade "pip>=9.0,<9.1" - $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate; cd st2client ; python setup.py install ; cd .. + $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate; cd st2client ; $(VIRTUALENV_ST2CLIENT_DIR)/bin/python setup.py install ; cd .. $(VIRTUALENV_ST2CLIENT_DIR)/bin/st2 --version $(VIRTUALENV_ST2CLIENT_DIR)/bin/python -c "import st2client" From 77e2f41e0c1af346965449cfc99ad77ce3a05d2d Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 23 Oct 2018 20:33:38 +0200 Subject: [PATCH 4/8] Fix path. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 30e56dee05..d705b794cf 100644 --- a/Makefile +++ b/Makefile @@ -257,7 +257,7 @@ flake8: requirements .flake8 chmod +x $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate $(VIRTUALENV_ST2CLIENT_DIR)/bin/pip install --upgrade "pip>=9.0,<9.1" - $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate; cd st2client ; $(VIRTUALENV_ST2CLIENT_DIR)/bin/python setup.py install ; cd .. + $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate; cd st2client ; ../$(VIRTUALENV_ST2CLIENT_DIR)/bin/python setup.py install ; cd .. $(VIRTUALENV_ST2CLIENT_DIR)/bin/st2 --version $(VIRTUALENV_ST2CLIENT_DIR)/bin/python -c "import st2client" From 0345e157ca21dbb5ef7cff6148c3a0119e4ce534 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 23 Oct 2018 20:33:45 +0200 Subject: [PATCH 5/8] Also install libffi-dev on travis. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9e67239e88..e4912a9e2a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -82,7 +82,7 @@ before_install: - echo "deb [arch=amd64] http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.4 multiverse" | sudo tee -a /etc/apt/sources.list # Work around for Travis timeout issues, see https://github.com/travis-ci/travis-ci/issues/9112 - sudo apt-get update --option Acquire::Retries=100 --option Acquire::http::Timeout="60" - - sudo apt-get install mongodb-org-server mongodb-org-shell git -y + - sudo apt-get install mongodb-org-server mongodb-org-shell git libffi-dev -y - pip install --upgrade "pip>=9.0,<9.1" - sudo pip install --upgrade "virtualenv==15.1.0" From 12463adfa6d9816f489ae70166c01dd1f70d5633 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 23 Oct 2018 20:47:33 +0200 Subject: [PATCH 6/8] Add cryptography dependency to st2client in requirements. --- st2client/in-requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/st2client/in-requirements.txt b/st2client/in-requirements.txt index 1bcf2d0b7a..7e1f3f3c23 100644 --- a/st2client/in-requirements.txt +++ b/st2client/in-requirements.txt @@ -11,3 +11,4 @@ six sseclient python-editor prompt-toolkit +cryptography From 3fc39c9173e3875fdde65ff23a2f17a7a20b4aa5 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 23 Oct 2018 20:48:29 +0200 Subject: [PATCH 7/8] Update .gitignore. --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 90bbd3043f..13a3046a1d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,9 @@ develop-eggs lib64 virtualenv virtualenv-py3 +virtualenv-osx +virtualenv-st2client +virtualenv-st2client-osx # Installer logs pip-log.txt From 7cfa50c54a68a604ff564a40357da8b5d2780e13 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Tue, 23 Oct 2018 20:48:39 +0200 Subject: [PATCH 8/8] Re-generate requirement files. --- st2client/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/st2client/requirements.txt b/st2client/requirements.txt index fec0a83097..cdcc42b4a6 100644 --- a/st2client/requirements.txt +++ b/st2client/requirements.txt @@ -1,5 +1,6 @@ # Don't edit this file. It's generated automatically! argcomplete +cryptography==2.3.1 jsonpath-rw==1.4.0 jsonschema==2.6.0 prettytable