From ee25d35db12a09f721cecac43cf20a72172f09f7 Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 15 Feb 2024 14:37:31 +0000 Subject: [PATCH] Fix Python 3.9 support I installed pyenv and then installed Python 3.9: $ pyenv install 3.9 $ eval "$(pyenv init -)" $ pyenv shell 3.9 In a clean repository I ran $ scripts/cmdeploy init $ scripts/cmdeploy run $ scripts/cmdeploy dns $ scripts/cmdeploy fmt With the changes made all these commands work. scripts/cmdeploy test fails some tests using maildata fixture at importlib.resources.files(__package__).joinpath("mail-data") line but this is not critical. --- cmdeploy/src/cmdeploy/dns.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmdeploy/src/cmdeploy/dns.py b/cmdeploy/src/cmdeploy/dns.py index e3f6f5c2..f87a229c 100644 --- a/cmdeploy/src/cmdeploy/dns.py +++ b/cmdeploy/src/cmdeploy/dns.py @@ -5,6 +5,8 @@ import importlib import subprocess import datetime +from typing import Optional + class DNS: def __init__(self, out, mail_domain): @@ -34,7 +36,7 @@ class DNS: cmd = "ip a | grep inet6 | grep 'scope global' | sed -e 's#/64 scope global##' | sed -e 's#inet6##'" return self.shell(cmd).strip() - def get(self, typ: str, domain: str) -> str | None: + def get(self, typ: str, domain: str) -> Optional[str]: """Get a DNS entry""" dig_result = self.shell(f"dig -r -q {domain} -t {typ} +short") line = dig_result.partition("\n")[0]