From b39062018c2ef3e6b793aef8fb0e217401bbc642 Mon Sep 17 00:00:00 2001 From: Jean-Louis Leroy Date: Wed, 28 Aug 2024 15:43:37 -0400 Subject: [PATCH] schemagen: remove xsdata[cli] from requirements, add copyright notice, black Signed-off-by: Jean-Louis Leroy --- src/python/bin/schemagen | 52 ++++++++++++++++++++++++++++++++++--- src/python/requirements.txt | 1 - 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/src/python/bin/schemagen b/src/python/bin/schemagen index 5f06709f8..1d7facc70 100755 --- a/src/python/bin/schemagen +++ b/src/python/bin/schemagen @@ -1,16 +1,60 @@ #! /usr/bin/env bash +# This script generates Python classes corresponding to 'mqbcfg.xsd' and +# 'mqbconf.xsd' + set -e this=$(dirname "$0") python_root=$(realpath "${this}"/..) blazingmq_root=$(realpath "${python_root}/../..") -if [ ! "$(which xsdata)" ]; then - echo "'xsdata' is required" +if ! command -v xsdata; then + cat < $1 + black -q $1 +} + +function generate { + xsdata generate --package blazingmq.schemas "$1" + copyright_black $2 +} + +generate "${blazingmq_root}/src/groups/mqb/mqbcfg/mqbcfg.xsd" blazingmq/schemas/mqbcfg.py +generate "${blazingmq_root}/src/groups/mqb/mqbconfm/mqbconf.xsd" blazingmq/schemas/mqbconf.py +copyright_black blazingmq/schemas/__init__.py diff --git a/src/python/requirements.txt b/src/python/requirements.txt index 0ee454310..aaa395a90 100644 --- a/src/python/requirements.txt +++ b/src/python/requirements.txt @@ -10,4 +10,3 @@ pytest-xdist pyyaml termcolor xsdata -xsdata[cli]