Skip to content

Commit c557b99

Browse files
committed
packaging: fix Python 3.9 builds, do basic test
1 parent d308b42 commit c557b99

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

.github/workflows/test.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ jobs:
4040
- name: Check spelling
4141
uses: crate-ci/[email protected]
4242

43+
# Test instal works on untestable Python versions. This came about because click decided to drop
44+
# Python 3.9 support before EOL, so 3.9 was dropped from the unit test matrix. Still need to test
45+
# that pyinfra can be built on 3.9.
46+
build-legacy-versions:
47+
strategy:
48+
matrix:
49+
python-version: ["3.9"]
50+
runs-on: ubuntu-24.04
51+
steps:
52+
- uses: actions/checkout@v4
53+
- uses: actions/setup-python@v5
54+
with:
55+
python-version: ${{ matrix.python-version }}
56+
- run: pip install '.'
57+
- run: pyinfra --help
58+
4359
# Unit tests
4460
#
4561

pyinfra/facts/server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import shutil
77
from datetime import datetime
88
from tempfile import mkdtemp
9-
from typing import Dict, Iterable, List, Optional, Tuple
9+
from typing import Dict, Iterable, List, Optional, Tuple, Union
1010

1111
from dateutil.parser import parse as parse_date
1212
from distro import distro
@@ -280,7 +280,7 @@ def replace_octal(s: str) -> str:
280280
return devices
281281

282282

283-
class Port(FactBase[Tuple[str, int] | Tuple[None, None]]):
283+
class Port(FactBase[Union[Tuple[str, int], Tuple[None, None]]]):
284284
"""
285285
Returns the process occuping a port and its PID
286286
"""
@@ -290,7 +290,7 @@ def command(self, port: int) -> str:
290290
return f"ss -lptnH 'src :{port}'"
291291

292292
@override
293-
def process(self, output: Iterable[str]) -> Tuple[str, int] | Tuple[None, None]:
293+
def process(self, output: Iterable[str]) -> Union[Tuple[str, int], Tuple[None, None]]:
294294
for line in output:
295295
proc, pid = line.split('"')[1], int(line.split("pid=")[1].split(",")[0])
296296
return (proc, pid)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
# Typing
5555
"mypy",
5656
"types-cryptography",
57-
"types-paramiko",
57+
"types-paramiko<4",
5858
"types-python-dateutil",
5959
"types-PyYAML",
6060
)

0 commit comments

Comments
 (0)