Skip to content

Commit

Permalink
fix: use packaging.versio rather than pkg_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
davecoates committed Aug 6, 2024
1 parent 836f093 commit 0645b02
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
from pathlib import Path
from pkg_resources import parse_version
from packaging.version import Version
import re
import subprocess

Expand All @@ -14,15 +14,15 @@
# get rid of html comments
file_contents = re.sub('<!--.*?-->', '', file_contents, flags=re.MULTILINE | re.DOTALL)

highest_ver = parse_version("0")
highest_ver = Version("0")
ver_string = "0"
for line in file_contents.split("\n"):
if line.startswith("## "):
match = version_header_re.match(line)
if not match:
raise ValueError(f"!!Cannot interpret header in {repr(line)}")
try:
cur_ver = parse_version(match.group("ver"))
cur_ver = Version(match.group("ver"))
except ValueError as e:
raise ValueError(f"Cannot interpret version in {repr(line)}") from e
if cur_ver >= highest_ver:
Expand Down

0 comments on commit 0645b02

Please sign in to comment.