Skip to content

Commit

Permalink
bug: fix set version release script (#736)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanrfrazier authored Sep 5, 2023
1 parent 55da1be commit 43218d7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import tomlkit
import argparse
from typing import Dict
from typing import List
from collections import defaultdict
from tomlkit import dumps
from typing import Dict, List
from packaging.version import parse

def get_value_from_toml(file_path: str, toml_path: str | List[str]) -> str:
Expand Down Expand Up @@ -32,7 +33,7 @@ def update_versions(entries: List[str], version: str) -> None:
# Dictionary to hold the paths for each file
file_paths_dict = defaultdict(list)

for entry in args.entries:
for entry in entries:
parts = entry.split(":")
if len(parts) != 2:
print(f"Invalid entry format: {entry}")
Expand All @@ -47,7 +48,7 @@ def update_versions(entries: List[str], version: str) -> None:
with open(file_path, 'r') as f:
data = tomlkit.parse(f.read())

update_version_in_data(data, args.version, paths)
update_version_in_data(data, version, paths)

with open(file_path, 'w') as f:
f.write(dumps(data))
Expand Down Expand Up @@ -84,7 +85,7 @@ def main() -> None:
version = normalize_version(version)
print(version)
elif args.command == "set":
set_version(args.toml_file, args.key, args.version)
update_versions(args.entries, args.version)
elif args.command == "normalize":
print(normalize_version(args.version))
else:
Expand Down

0 comments on commit 43218d7

Please sign in to comment.