Skip to content

Commit

Permalink
Prepare 3.0.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgear authored Dec 29, 2023
2 parents 91162f9 + d209658 commit 4e54af0
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 19 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ Notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.3] - 2023-12-29

### Changed

- Complete fixing of typing to restore compatibility with python 3.8.

## [3.0.2] - 2023-12-28

### Changed
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PREFIX=/usr/local
SHAREDIR=share/$(NAME)
SYSTEMD_SERVICE_DIR=/lib/systemd/system
USER=$(NAME)
VERSION=3.0.2
VERSION=3.0.3
RELEASE=1

TESTS=\
Expand All @@ -22,10 +22,10 @@ TESTS=\
test: pytest datatest

pytest:
PYTHONPATH=$(PWD)/src python3 -m pytest $(TESTS)
PYTHONPATH=./src python3 -m pytest $(TESTS)

datatest:
PYTHONPATH=$(PWD)/src ./testdata/testdata.sh
PYTHONPATH=./src ./testdata/testdata.sh

format:
black --line-length=128 --target-version=py39 src/ unit_tests/
Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
ntpmon (3.0.3-1) focal; urgency=medium

* Further fixes to focal build.

-- Paul Gear <[email protected]> Fri, 29 Dec 2023 14:38:42 +1000

ntpmon (3.0.2-1) focal; urgency=medium

* New upstream release to fix failing focal build.
Expand Down
2 changes: 1 addition & 1 deletion debian/check_ntpmon-man.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:Version: 3.0.2
:Version: 3.0.3
:Date: 2023-12-28
:Copyright: 2015-2023 Paul Gear
:Title: check_ntpmon
Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Section: python
Priority: optional
Maintainer: Paul Gear <[email protected]>
Build-Depends:
debhelper,
debhelper (>= 12),
dh-python,
python3-all,
python3-docutils,
Expand Down
2 changes: 1 addition & 1 deletion debian/ntpmon-man.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
:Version: 3.0.2
:Version: 3.0.3
:Date: 2023-12-28
:Copyright: 2015-2023 Paul Gear
:Title: ntpmon
Expand Down
14 changes: 7 additions & 7 deletions src/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys

from io import TextIOWrapper
from typing import ClassVar, Dict
from typing import ClassVar, Dict, List, Tuple


import line_protocol
Expand Down Expand Up @@ -110,7 +110,7 @@ def __init__(self, args: argparse.Namespace) -> None:

prometheus_client.start_http_server(addr=args.listen_address, port=args.port)

peerstatslabels: ClassVar[list[str]] = [
peerstatslabels: ClassVar[List[str]] = [
"mode",
"refid",
"rx_timestamp",
Expand Down Expand Up @@ -150,7 +150,7 @@ def __init__(self, args: argparse.Namespace) -> None:
"synchronized": ("i", None, "Whether the peer reports as synchronized"),
}

summarystatstypes: ClassVar[Dict[str, tuple[str, str, str]]] = {
summarystatstypes: ClassVar[Dict[str, Tuple[str, str, str]]] = {
"frequency": (None, "_hertz", "Frequency error of the local clock"),
"offset": (None, "_seconds", "Mean clock offset of peers"),
"reach": ("%", "_ratio", "Peer reachability over the last 8 polls"),
Expand Down Expand Up @@ -193,8 +193,8 @@ def send_stats(
prefix: str,
metrics: dict,
metrictypes: dict,
labelnames: list[str] = [],
labels: list[str] = [],
labelnames: List[str] = [],
labels: List[str] = [],
debug: bool = False,
) -> None:
for metric in sorted(metrictypes.keys()):
Expand All @@ -217,8 +217,8 @@ def set_prometheus_metric(
description: str,
value: float,
fmt: str,
labelnames: list[str],
labels: list[str],
labelnames: List[str],
labels: List[str],
debug: bool = False,
) -> None:
import prometheus_client
Expand Down
9 changes: 5 additions & 4 deletions src/peer_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import datetime
import re
import sys
from typing import List


leapcodes = {
Expand Down Expand Up @@ -64,7 +65,7 @@ def checkfail(test: str) -> int:
# 20. Source of the local receive timestamp (D=daemon, K=kernel, H=hardware). [K]


def extract_chrony_measurements(f: list[str]) -> dict:
def extract_chrony_measurements(f: List[str]) -> dict:
return {
# sorted by field position rather than name
"datetime": datetime.datetime.fromisoformat("+".join((f[0], f[1], "00:00"))),
Expand Down Expand Up @@ -118,7 +119,7 @@ def extract_chrony_measurements(f: list[str]) -> dict:
# negative value means the delay of packets sent to the source is more variable than the delay of packets sent from the source back. [0.00, i.e. no correction for asymmetry]


def extract_chrony_statistics(f: list[str]) -> dict:
def extract_chrony_statistics(f: List[str]) -> dict:
return {
# sort by field position rather than name
"datetime": datetime.datetime.fromisoformat("+".join((f[0], f[1], "00:00"))),
Expand Down Expand Up @@ -155,7 +156,7 @@ def extract_chrony_statistics(f: list[str]) -> dict:
# dispersion from the previous update with the dispersion which accumulated in the interval. [8.304e-03]


def extract_chrony_tracking(f: list[str]) -> dict:
def extract_chrony_tracking(f: List[str]) -> dict:
return {
# sort by field position rather than name
"datetime": datetime.datetime.fromisoformat("+".join((f[0], f[1], "00:00"))),
Expand Down Expand Up @@ -186,7 +187,7 @@ def extract_chrony_tracking(f: list[str]) -> dict:
# 0.000958674 s RMS jitter


def extract_ntp_peerstats(f: list[str]) -> dict:
def extract_ntp_peerstats(f: List[str]) -> dict:
basefields = {
# sorted by field position rather than name
"datetime": datetime.datetime.fromtimestamp(mjd_to_timestamp(float(f[0]), float(f[1]))),
Expand Down
6 changes: 4 additions & 2 deletions src/tailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import sys
import time

from typing import List


class Tailer:

Expand Down Expand Up @@ -42,7 +44,7 @@ def open(self) -> None:
finally:
self.first_time = False

def readlines(self) -> list[str]:
def readlines(self) -> List[str]:
"""Read all of the remaining lines in the currently-open file."""
try:
self.file.seek(0, os.SEEK_END)
Expand All @@ -66,7 +68,7 @@ def readlines(self) -> list[str]:
except OSError:
pass

def tail(self) -> list[str]:
def tail(self) -> List[str]:
"""Get the lines from the file. Handle the case where the file is not
yet open, or if it has been deleted and recreated."""
if self.file is None:
Expand Down

0 comments on commit 4e54af0

Please sign in to comment.