Skip to content

Commit 1282076

Browse files
authored
Merge branch 'master' into better-st2-self-check-error-messages
2 parents f3a900b + ed3b42d commit 1282076

File tree

76 files changed

+1078
-1038
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1078
-1038
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ jobs:
3838
# scripts/travis/run-nightly-make-task-if-exists.sh
3939
- name: "Unit Tests (Python 2.7 MongoDB 4.0)"
4040
python: 2.7
41-
env: TASK=ci-unit CACHE_NAME=py2 COMMAND_THRESHOLD=700
41+
env: TASK=ci-unit CACHE_NAME=py2 PYTHON_VERSION=python2.7 COMMAND_THRESHOLD=700
4242

4343
- name: "Integration Tests (Python 2.7)"
4444
python: 2.7
45-
env: TASK=ci-integration CACHE_NAME=py2 COMMAND_THRESHOLD=700
45+
env: TASK=ci-integration CACHE_NAME=py2 PYTHON_VERSION=python2.7 COMMAND_THRESHOLD=700
4646

47-
- name: "Lint Checks, Packs Tests (Python 2.7)"
48-
python: 2.7
49-
env: TASK="ci-checks ci-packs-tests" CACHE_NAME=py2 COMMAND_THRESHOLD=430
47+
- name: "Lint Checks, Packs Tests (Python 3.6)"
48+
python: 3.6
49+
env: TASK="ci-checks ci-packs-tests" CACHE_NAME=py3 PYTHON_VERSION=python3.6 COMMAND_THRESHOLD=430
5050

5151
- name: "Unit Tests, Pack Tests (Python 3.6)"
5252
python: 3.6

Makefile

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ else
1515
VIRTUALENV_COMPONENTS_DIR ?= virtualenv-components
1616
endif
1717

18-
PYTHON_VERSION ?= python2.7
18+
PYTHON_VERSION ?= $(shell if [ -z "`which python3.6`" ]; then echo "python2.7"; else echo "python3.6"; fi)
1919

2020
BINARIES := bin
2121

@@ -50,7 +50,12 @@ COMPONENTS_TEST_MODULES_COMMA := $(subst $(space_char),$(comma),$(COMPONENTS_TES
5050
COVERAGE_GLOBS := .coverage.unit.* .coverage.integration.*
5151
COVERAGE_GLOBS_QUOTED := $(foreach glob,$(COVERAGE_GLOBS),'$(glob)')
5252

53-
REQUIREMENTS := test-requirements.txt requirements.txt
53+
ifeq ($(PYTHON_VERSION),python2.7)
54+
REQUIREMENTS := test-requirements-py27.txt requirements.txt
55+
else
56+
REQUIREMENTS := test-requirements.txt requirements.txt
57+
endif
58+
5459
# Pin common pip version here across all the targets
5560
# Note! Periodic maintenance pip upgrades are required to be up-to-date with the latest pip security fixes and updates
5661
PIP_VERSION ?= 20.0.2
@@ -107,6 +112,8 @@ all: requirements configgen check tests
107112
# Target for debugging Makefile variable assembly
108113
.PHONY: play
109114
play:
115+
@echo PYTHON_VERSION=$(PYTHON_VERSION)
116+
@echo
110117
@echo COVERAGE_GLOBS=$(COVERAGE_GLOBS_QUOTED)
111118
@echo
112119
@echo COMPONENTS=$(COMPONENTS)
@@ -226,8 +233,7 @@ check-python-packages:
226233
@echo ""
227234
@echo "================== CHECK PYTHON PACKAGES ===================="
228235
@echo ""
229-
230-
test -f $(VIRTUALENV_COMPONENTS_DIR)/bin/activate || virtualenv --python=$(PYTHON_VERSION) $(VIRTUALENV_COMPONENTS_DIR) --no-download
236+
test -f $(VIRTUALENV_COMPONENTS_DIR)/bin/activate || virtualenv --python=$(PYTHON_VERSION) $(VIRTUALENV_COMPONENTS_DIR) --no-download --system-site-packages
231237
@for component in $(COMPONENTS_WITHOUT_ST2TESTS); do \
232238
echo "==========================================================="; \
233239
echo "Checking component:" $$component; \
@@ -263,7 +269,7 @@ checklogs:
263269
@echo
264270
@echo "================== LOG WATCHER ===================="
265271
@echo
266-
. $(VIRTUALENV_DIR)/bin/activate; ./tools/log_watcher.py 10
272+
. $(VIRTUALENV_DIR)/bin/activate; python ./tools/log_watcher.py 10
267273

268274
.PHONY: pylint
269275
pylint: requirements .pylint
@@ -329,7 +335,7 @@ lint-api-spec: requirements .lint-api-spec
329335
@echo
330336
@echo "================== Lint API spec ===================="
331337
@echo
332-
. $(VIRTUALENV_DIR)/bin/activate; st2common/bin/st2-validate-api-spec --config-file conf/st2.dev.conf
338+
. $(VIRTUALENV_DIR)/bin/activate; python st2common/bin/st2-validate-api-spec --config-file conf/st2.dev.conf
333339

334340
.PHONY: generate-api-spec
335341
generate-api-spec: requirements .generate-api-spec
@@ -343,14 +349,14 @@ generate-api-spec: requirements .generate-api-spec
343349
echo "# Edit st2common/st2common/openapi.yaml.j2 and then run" >> st2common/st2common/openapi.yaml
344350
echo "# make .generate-api-spec" >> st2common/st2common/openapi.yaml
345351
echo "# to generate the final spec file" >> st2common/st2common/openapi.yaml
346-
. $(VIRTUALENV_DIR)/bin/activate; st2common/bin/st2-generate-api-spec --config-file conf/st2.dev.conf >> st2common/st2common/openapi.yaml
352+
. $(VIRTUALENV_DIR)/bin/activate; python st2common/bin/st2-generate-api-spec --config-file conf/st2.dev.conf >> st2common/st2common/openapi.yaml
347353

348354
.PHONY: circle-lint-api-spec
349355
circle-lint-api-spec:
350356
@echo
351357
@echo "================== Lint API spec ===================="
352358
@echo
353-
. $(VIRTUALENV_DIR)/bin/activate; st2common/bin/st2-validate-api-spec --config-file conf/st2.dev.conf || echo "Open API spec lint failed."
359+
. $(VIRTUALENV_DIR)/bin/activate; python st2common/bin/st2-validate-api-spec --config-file conf/st2.dev.conf || echo "Open API spec lint failed."
354360

355361
.PHONY: flake8
356362
flake8: requirements .flake8
@@ -375,7 +381,7 @@ flake8: requirements .flake8
375381
@echo
376382
@echo "==================== st2client install check ===================="
377383
@echo
378-
test -f $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate || virtualenv --python=$(PYTHON_VERSION) $(VIRTUALENV_ST2CLIENT_DIR) --no-download
384+
test -f $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate || virtualenv --python=$(PYTHON_VERSION) $(VIRTUALENV_ST2CLIENT_DIR) --no-download --system-site-packages
379385

380386
# Setup PYTHONPATH in bash activate script...
381387
# Delete existing entries (if any)
@@ -389,11 +395,12 @@ flake8: requirements .flake8
389395
touch $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate
390396
chmod +x $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate
391397

392-
$(VIRTUALENV_ST2CLIENT_DIR)/bin/pip install --upgrade "pip==$(PIP_VERSION)"
393398
# NOTE We need to upgrade setuptools to avoid bug with dependency resolving in old versions
394399
# Setuptools 42 added support for python_requires, which is used by the configparser package,
395400
# which is required by the importlib-metadata package
401+
$(VIRTUALENV_ST2CLIENT_DIR)/bin/pip install --upgrade "pip==$(PIP_VERSION)"
396402
$(VIRTUALENV_ST2CLIENT_DIR)/bin/pip install --upgrade "setuptools==44.1.0"
403+
397404
$(VIRTUALENV_ST2CLIENT_DIR)/bin/activate; cd st2client ; ../$(VIRTUALENV_ST2CLIENT_DIR)/bin/python setup.py install ; cd ..
398405
$(VIRTUALENV_ST2CLIENT_DIR)/bin/st2 --version
399406
$(VIRTUALENV_ST2CLIENT_DIR)/bin/python -c "import st2client"
@@ -541,10 +548,9 @@ requirements: virtualenv .requirements .sdist-requirements install-runners insta
541548
fi
542549

543550
# Install requirements
544-
#
545551
for req in $(REQUIREMENTS); do \
546-
echo "Installing $$req..." ; \
547-
$(VIRTUALENV_DIR)/bin/pip install $(PIP_OPTIONS) -r $$req ; \
552+
echo "Installing $$req..." ; \
553+
$(VIRTUALENV_DIR)/bin/pip install $(PIP_OPTIONS) -r $$req ; \
548554
done
549555

550556
# Install st2common package to load drivers defined in st2common setup.py
@@ -626,7 +632,7 @@ endif
626632
tests: pytests
627633

628634
.PHONY: pytests
629-
pytests: compile requirements .flake8 .pylint .pytests-coverage
635+
pytests: compilepy3 requirements .flake8 .pylint .pytests-coverage
630636

631637
.PHONY: .pytests
632638
.pytests: compile .configgen .generate-api-spec .unit-tests clean
@@ -963,7 +969,7 @@ debs:
963969
ci: ci-checks ci-unit ci-integration ci-packs-tests
964970

965971
.PHONY: ci-checks
966-
ci-checks: compile .generated-files-check .pylint .flake8 check-requirements check-sdist-requirements .st2client-dependencies-check .st2common-circular-dependencies-check circle-lint-api-spec .rst-check .st2client-install-check check-python-packages
972+
ci-checks: compilepy3 .generated-files-check .pylint .flake8 check-requirements check-sdist-requirements .st2client-dependencies-check .st2common-circular-dependencies-check circle-lint-api-spec .rst-check .st2client-install-check check-python-packages
967973

968974
.PHONY: ci-py3-unit
969975
ci-py3-unit:

0 commit comments

Comments
 (0)