15
15
VIRTUALENV_COMPONENTS_DIR ?= virtualenv-components
16
16
endif
17
17
18
- PYTHON_VERSION ?= python2.7
18
+ PYTHON_VERSION ?= $( shell if [ -z "`which python3.6`" ]; then which python2.7; else which python3.6; fi)
19
19
20
20
BINARIES := bin
21
21
@@ -107,6 +107,8 @@ all: requirements configgen check tests
107
107
# Target for debugging Makefile variable assembly
108
108
.PHONY : play
109
109
play :
110
+ @echo PYTHON_VERSION=$(PYTHON_VERSION )
111
+ @echo
110
112
@echo COVERAGE_GLOBS=$(COVERAGE_GLOBS_QUOTED )
111
113
@echo
112
114
@echo COMPONENTS=$(COMPONENTS )
@@ -226,8 +228,7 @@ check-python-packages:
226
228
@echo " "
227
229
@echo " ================== CHECK PYTHON PACKAGES ===================="
228
230
@echo " "
229
-
230
- test -f $(VIRTUALENV_COMPONENTS_DIR)/bin/activate || virtualenv --python=$(PYTHON_VERSION) $(VIRTUALENV_COMPONENTS_DIR) --no-download
231
+ test -f $(VIRTUALENV_COMPONENTS_DIR ) /bin/activate || virtualenv --python=$(PYTHON_VERSION ) $(VIRTUALENV_COMPONENTS_DIR ) --no-download --system-site-packages
231
232
@for component in $(COMPONENTS_WITHOUT_ST2TESTS ) ; do \
232
233
echo " ===========================================================" ; \
233
234
echo " Checking component:" $$ component; \
@@ -263,7 +264,7 @@ checklogs:
263
264
@echo
264
265
@echo " ================== LOG WATCHER ===================="
265
266
@echo
266
- . $(VIRTUALENV_DIR ) /bin/activate; ./tools/log_watcher.py 10
267
+ . $(VIRTUALENV_DIR ) /bin/activate; python ./tools/log_watcher.py 10
267
268
268
269
.PHONY : pylint
269
270
pylint : requirements .pylint
@@ -329,7 +330,7 @@ lint-api-spec: requirements .lint-api-spec
329
330
@echo
330
331
@echo " ================== Lint API spec ===================="
331
332
@echo
332
- . $(VIRTUALENV_DIR ) /bin/activate; st2common/bin/st2-validate-api-spec --config-file conf/st2.dev.conf
333
+ . $(VIRTUALENV_DIR ) /bin/activate; python st2common/bin/st2-validate-api-spec --config-file conf/st2.dev.conf
333
334
334
335
.PHONY : generate-api-spec
335
336
generate-api-spec : requirements .generate-api-spec
@@ -343,14 +344,14 @@ generate-api-spec: requirements .generate-api-spec
343
344
echo " # Edit st2common/st2common/openapi.yaml.j2 and then run" >> st2common/st2common/openapi.yaml
344
345
echo " # make .generate-api-spec" >> st2common/st2common/openapi.yaml
345
346
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
347
+ . $(VIRTUALENV_DIR ) /bin/activate; python st2common/bin/st2-generate-api-spec --config-file conf/st2.dev.conf >> st2common/st2common/openapi.yaml
347
348
348
349
.PHONY : circle-lint-api-spec
349
350
circle-lint-api-spec :
350
351
@echo
351
352
@echo " ================== Lint API spec ===================="
352
353
@echo
353
- . $(VIRTUALENV_DIR ) /bin/activate; st2common/bin/st2-validate-api-spec --config-file conf/st2.dev.conf || echo " Open API spec lint failed."
354
+ . $(VIRTUALENV_DIR ) /bin/activate; python st2common/bin/st2-validate-api-spec --config-file conf/st2.dev.conf || echo " Open API spec lint failed."
354
355
355
356
.PHONY : flake8
356
357
flake8 : requirements .flake8
@@ -375,7 +376,7 @@ flake8: requirements .flake8
375
376
@echo
376
377
@echo " ==================== st2client install check ===================="
377
378
@echo
378
- test -f $(VIRTUALENV_ST2CLIENT_DIR ) /bin/activate || virtualenv --python=$(PYTHON_VERSION ) $(VIRTUALENV_ST2CLIENT_DIR ) --no-download
379
+ test -f $(VIRTUALENV_ST2CLIENT_DIR ) /bin/activate || virtualenv --python=$(PYTHON_VERSION ) $(VIRTUALENV_ST2CLIENT_DIR ) --no-download --system-site-packages
379
380
380
381
# Setup PYTHONPATH in bash activate script...
381
382
# Delete existing entries (if any)
@@ -389,11 +390,12 @@ flake8: requirements .flake8
389
390
touch $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate
390
391
chmod +x $(VIRTUALENV_ST2CLIENT_DIR)/bin/activate
391
392
392
- $(VIRTUALENV_ST2CLIENT_DIR)/bin/pip install --upgrade "pip==$(PIP_VERSION)"
393
393
# NOTE We need to upgrade setuptools to avoid bug with dependency resolving in old versions
394
394
# Setuptools 42 added support for python_requires, which is used by the configparser package,
395
395
# which is required by the importlib-metadata package
396
+ $(VIRTUALENV_ST2CLIENT_DIR)/bin/pip install --upgrade "pip==$(PIP_VERSION)"
396
397
$(VIRTUALENV_ST2CLIENT_DIR)/bin/pip install --upgrade "setuptools==44.1.0"
398
+
397
399
$(VIRTUALENV_ST2CLIENT_DIR)/bin/activate; cd st2client ; ../$(VIRTUALENV_ST2CLIENT_DIR)/bin/python setup.py install ; cd ..
398
400
$(VIRTUALENV_ST2CLIENT_DIR)/bin/st2 --version
399
401
$(VIRTUALENV_ST2CLIENT_DIR)/bin/python -c "import st2client"
@@ -626,7 +628,7 @@ endif
626
628
tests : pytests
627
629
628
630
.PHONY : pytests
629
- pytests : compile requirements .flake8 .pylint .pytests-coverage
631
+ pytests : compilepy3 requirements .flake8 .pylint .pytests-coverage
630
632
631
633
.PHONY : .pytests
632
634
.pytests : compile .configgen .generate-api-spec .unit-tests clean
@@ -963,7 +965,7 @@ debs:
963
965
ci : ci-checks ci-unit ci-integration ci-packs-tests
964
966
965
967
.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
968
+ 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
967
969
968
970
.PHONY : ci-py3-unit
969
971
ci-py3-unit :
0 commit comments