@@ -14,9 +14,8 @@ space_char +=
1414comma := ,
1515COMPONENT_PYTHONPATH = $(subst $(space_char ) ,:,$(realpath $(COMPONENTS ) ) )
1616
17- PYTHON_TARGET := 3.10
18-
19- REQUIREMENTS := test-requirements.txt requirements.txt
17+ PYTHON_VERSION := $(shell python3 --version | sed -r 's/.* ([[0-9]+\.[0-9]+) \.[0-9]+.*/\1/g')
18+ REQUIREMENTS := test-requirements-$(PYTHON_VERSION ) .txt requirements.txt
2019# Grab the version of pip from the Makefile in the st2 repository
2120#
2221# 1. Grab the st2 branch name from ST2_BRANCH
@@ -73,7 +72,7 @@ pylint: requirements .pylint
7372 . $(VIRTUALENV_DIR ) /bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc packs/fixtures/actions/scripts/* /* .py || exit 1;
7473 . $(VIRTUALENV_DIR ) /bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc packs/fixtures/sensors/* .py || exit 1;
7574 . $(VIRTUALENV_DIR ) /bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc packs/asserts/actions/* .py || exit 1;
76-
75+
7776.PHONY : flake8
7877flake8 : requirements .flake8
7978
@@ -140,3 +139,17 @@ $(VIRTUALENV_DIR)/bin/activate:
140139 echo ' functions -e old_deactivate' >> $(VIRTUALENV_DIR)/bin/activate.fish
141140 echo 'end' >> $(VIRTUALENV_DIR)/bin/activate.fish
142141 touch $(VIRTUALENV_DIR)/bin/activate.fish
142+
143+ .PHONY : piptools
144+ piptools : virtualenv
145+ @echo
146+ @echo " ================== Install pip-tools ===================="
147+ @echo
148+ " $( VIRTUALENV_DIR) /bin/pip" install pip-tools
149+
150+ .PHONY : generate_requirements
151+ generate_requirements : piptools
152+ @echo
153+ @echo " ================== Generate requirements file ===================="
154+ @echo
155+ " $( VIRTUALENV_DIR) /bin/pip-compile" --output-file=$(ROOT_DIR ) /test-requirements-$(PYTHON_VERSION ) .txt $(ROOT_DIR ) /test-requirements.in
0 commit comments