Skip to content

Commit 8ee9ffc

Browse files
committed
fix: drop Python 3.7/3.8 support and fix Splunk Python path detection in CI
1 parent dbb307e commit 8ee9ffc

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

.github/workflows/build-test-release.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
- uses: actions/checkout@v4
5656
- uses: actions/setup-python@v5
5757
with:
58-
python-version: "3.7"
58+
python-version: "3.9"
5959
- uses: pre-commit/action@v3.0.1
6060

6161
semgrep:
@@ -71,8 +71,6 @@ jobs:
7171
strategy:
7272
matrix:
7373
python-version:
74-
- "3.7"
75-
- "3.8"
7674
- "3.9"
7775
- "3.10"
7876
- "3.11"
@@ -100,7 +98,7 @@ jobs:
10098
- uses: actions/checkout@v4
10199
- uses: actions/setup-python@v5
102100
with:
103-
python-version: 3.7
101+
python-version: "3.9"
104102
- run: curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1
105103
- name: Install Splunk
106104
run: |
@@ -167,7 +165,7 @@ jobs:
167165
persist-credentials: false
168166
- uses: actions/setup-python@v5
169167
with:
170-
python-version: "3.7"
168+
python-version: "3.9"
171169
- run: curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1
172170
- run: |
173171
poetry install

tests/integration/conftest.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@
1010
def setup_env():
1111
# path manipulation get the 'splunk' library for the imports while running on GH Actions
1212
if "SPLUNK_HOME" in os.environ:
13-
sys.path.append(
14-
os.path.sep.join(
15-
[os.environ["SPLUNK_HOME"], "lib", "python3.7", "site-packages"]
16-
)
13+
splunk_home = os.environ["SPLUNK_HOME"]
14+
lib_dir = os.path.join(splunk_home, "lib")
15+
# Find the highest available pythonX.Y directory in $SPLUNK_HOME/lib
16+
python_dirs = sorted(
17+
[
18+
d
19+
for d in os.listdir(lib_dir)
20+
if d.startswith("python3.") and os.path.isdir(os.path.join(lib_dir, d))
21+
],
22+
key=lambda d: tuple(int(x) for x in d[6:].split(".")),
23+
reverse=True,
1724
)
18-
# TODO: 'python3.7' needs to be updated as and when Splunk has new folder for Python.
25+
if python_dirs:
26+
sys.path.append(os.path.join(lib_dir, python_dirs[0], "site-packages"))
1927

2028

2129
@pytest.fixture(scope="session")

0 commit comments

Comments
 (0)