Skip to content

Commit

Permalink
Update applications-download, uses jsonschema-validator
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Nov 8, 2024
1 parent 7c79a73 commit 3edba7d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
10 changes: 5 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ twine = "5.1.1"
PyYAML = "6.0.2"
id = "1.4.0"
security-md = "0.2.3"
application-download = "0.0.1.dev3"
applications-download = "0.7.1"
jsonschema-validator-new = "0.1.0"
PyGithub = "2.5.0"
debian-inspector = "31.1.0"
multi-repo-automation = "1.4.1"
Expand Down
8 changes: 8 additions & 0 deletions tag_publish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
Tag Publish main module.
"""

import json
import os.path
import pkgutil
import re
import subprocess # nosec
from re import Match, Pattern
from typing import Any, Optional, TypedDict, cast

import application_download.cli
import github
import jsonschema_validator
import requests
import ruamel.yaml
import security_md
Expand Down Expand Up @@ -94,9 +97,14 @@ def get_config(gh: GH) -> tag_publish.configuration.Configuration:
"""
config: tag_publish.configuration.Configuration = {}
if os.path.exists(".github/publish.yaml"):
schema_data = pkgutil.get_data("tag_publish", "schema.json")
assert schema_data is not None
schema = json.loads(schema_data)

with open(".github/publish.yaml", encoding="utf-8") as open_file:
yaml_ = ruamel.yaml.YAML()
config = yaml_.load(open_file)
jsonschema_validator.validate(".github/publish.yaml", config, schema)

merge(
{
Expand Down
2 changes: 1 addition & 1 deletion tag_publish/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def _handle_pypi_publish(
if "packages" in pypi_config:
tag_publish.lib.oidc.pypi_login()

for package in pypi_config["packages"]:
for package in pypi_config.get("packages", []):
if package.get("group", tag_publish.configuration.PIP_PACKAGE_GROUP_DEFAULT) == group:
publish = version_type in pypi_config.get(
"versions", tag_publish.configuration.PYPI_VERSIONS_DEFAULT
Expand Down

0 comments on commit 3edba7d

Please sign in to comment.