Skip to content

Commit 2fe5cb0

Browse files
authored
Updates for st2 v3.10 support (#120)
2 parents b0bdcf1 + 84626f4 commit 2fe5cb0

5 files changed

Lines changed: 31 additions & 15 deletions

File tree

.github/workflows/lint-and-unit-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
python-version:
20-
- "3.8"
21-
- "3.9"
2220
- "3.10"
2321
- "3.11"
22+
- "3.12"
2423
steps:
2524
- name: Checkout repo
2625
uses: actions/checkout@v4

Makefile

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ VIRTUALENV_DIR ?= virtualenv
1818

1919
ST2_REPO_PATH ?= /tmp/st2
2020
ST2_REPO_BRANCH ?= master
21+
PYBIN := python3
2122

2223
PIP_OPTIONS := $(ST2_PIP_OPTIONS)
2324

@@ -44,27 +45,43 @@ play:
4445
@echo "`cat /etc/os-release`"
4546
@echo
4647

48+
.PHONY: clean
49+
clean:
50+
@echo
51+
@echo "==================== clean cache files and virtualenv ===================="
52+
@echo
53+
rm -rf ./.pytest_cache ./virtualenv ./st2_auth_ldap.egg-info
54+
find . -iname '*.pyc' -delete
55+
find . -iname '__pycache__' -delete
56+
4757
.PHONY: requirements
4858
requirements: .clone_st2_repo virtualenv
4959
@echo
5060
@echo "==================== requirements ===================="
5161
@echo
52-
$(eval PIP_VERSION := $(shell grep 'PIP_VERSION ?= ' /tmp/st2/Makefile | awk '{ print $$3}'))
53-
$(VIRTUALENV_DIR)/bin/pip install --upgrade "pip==$(PIP_VERSION)"
54-
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r $(ST2_REPO_PATH)/requirements.txt
55-
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r $(ST2_REPO_PATH)/test-requirements.txt
56-
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r requirements.txt
57-
$(VIRTUALENV_DIR)/bin/pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r test-requirements.txt
62+
$(eval PIP_VERSION ?= $(shell awk '/^PIP_VERSION/ {print $$3}' /tmp/st2/Makefile))
63+
$(eval SETUPTOOLS_VERSION ?= $(shell awk '/^SETUPTOOLS_VERSION/ {print $$3}' /tmp/st2/Makefile))
64+
@echo
65+
@echo
66+
@echo Install pip $(PIP_VERSION) and setuptools $(SETUPTOOLS_VERSION) to match st2 core.
67+
@echo
68+
@echo
69+
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --upgrade "pip==$(PIP_VERSION)"
70+
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --upgrade "setuptools==$(SETUPTOOLS_VERSION)"
71+
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r $(ST2_REPO_PATH)/requirements.txt
72+
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r $(ST2_REPO_PATH)/test-requirements.txt
73+
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r requirements.txt
74+
$(VIRTUALENV_DIR)/bin/$(PYBIN) -m pip install --cache-dir $(HOME)/.pip-cache $(PIP_OPTIONS) -r test-requirements.txt
5875

5976
@echo ""
6077
@echo "================== register st2auth ======================"
6178
@echo ""
6279
# Install st2auth
63-
(. $(VIRTUALENV_DIR)/bin/activate; cd $(ST2_REPO_PATH)/st2auth; python3 setup.py develop --no-deps)
80+
(. $(VIRTUALENV_DIR)/bin/activate; cd $(ST2_REPO_PATH)/st2auth; $(PYBIN) -m pip install --no-deps --editable .)
6481
@echo ""
6582
@echo "================== register ldap ======================"
6683
@echo ""
67-
(. $(VIRTUALENV_DIR)/bin/activate; python3 setup.py develop --no-deps)
84+
(. $(VIRTUALENV_DIR)/bin/activate; $(PYBIN) -m pip install --no-deps --editable .)
6885

6986
.PHONY: requirements-ci
7087

@@ -74,7 +91,7 @@ $(VIRTUALENV_DIR)/bin/activate:
7491
@echo
7592
@echo "==================== virtualenv ===================="
7693
@echo
77-
test -d $(VIRTUALENV_DIR) || virtualenv $(VIRTUALENV_DIR) -p python3
94+
test -d $(VIRTUALENV_DIR) || $(PYBIN) -m venv $(VIRTUALENV_DIR)
7895

7996
# Setup PYTHONPATH in bash activate script...
8097
# Delete existing entries (if any)
@@ -126,7 +143,7 @@ unit-tests: requirements .clone_st2_repo .unit-tests
126143
.PHONY: .clone_st2_repo
127144
.clone_st2_repo:
128145
@echo
129-
@echo "==================== cloning st2 repo ===================="
146+
@echo "==================== cloning st2 repo [$(ST2_REPO_BRANCH)] ===================="
130147
@echo
131148
@rm -rf /tmp/st2
132149
@git clone https://github.com/StackStorm/st2.git --depth 1 --single-branch --branch $(ST2_REPO_BRANCH) /tmp/st2

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ python-ldap>=3.4.0,<3.5.0
44
# - 3.1 adds python3.8
55
# - 4.2 adds python3.9
66
# - 5.2.1 adds python3.11
7-
cachetools>=3.1,<5.4.0
7+
cachetools<5.4.0,>=3.1

tests/unit/test_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def test_client_options(self):
275275
def test_invalid_group_dns_check_option(self):
276276
expected_msg = ('Invalid value "invalid" for group_dns_check option. Valid '
277277
'values are: and, or.')
278-
self.assertRaisesRegexp(
278+
self.assertRaisesRegex(
279279
ValueError,
280280
expected_msg,
281281
ldap_backend.LDAPAuthenticationBackend,

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py38,py39,py310,py311,lint
2+
envlist = py310,py311,py312,lint
33

44
[testenv]
55
deps = -r{toxinidir}/requirements.txt

0 commit comments

Comments
 (0)