Sync project metadata with pyproject.toml
Updated scripts and backend to dynamically retrieve project name and version from `pyproject.toml`. This ensures consistent metadata across the OpenAPI client generation and the FastAPI application.
This commit is contained in:
parent
d3d87dc9a2
commit
8fad28aa91
@ -3,15 +3,16 @@
|
||||
# Extract values from pyproject.toml
|
||||
PYPROJECT_FILE="$(dirname "$0")/pyproject.toml"
|
||||
|
||||
VERSION=$(grep -Po '(?<=version = ")[^"]*' "$PYPROJECT_FILE")
|
||||
NAME=$(grep -Po '(?<=name = ")[^\"]*' "$PYPROJECT_FILE" | sed 's/[^a-zA-Z0-9_-]//g') # Extract name and sanitize it
|
||||
# Extract name directly and ignore newlines
|
||||
NAME=$(awk -F'=' '/^name/ { gsub(/"/, "", $2); print $2 }' "$PYPROJECT_FILE" | xargs)
|
||||
VERSION=$(awk -F'=' '/^version/ { gsub(/"/, "", $2); print $2 }' "$PYPROJECT_FILE" | xargs)
|
||||
|
||||
if [[ -z "$VERSION" || -z "$NAME" ]]; then
|
||||
echo "Error: Could not determine version or name from pyproject.toml"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure NAME is valid (no special characters or newlines)
|
||||
# Ensure the extracted name is valid (No spaces or unexpected characters)
|
||||
if ! [[ "$NAME" =~ ^[a-zA-Z0-9_-]+$ ]]; then
|
||||
echo "Error: Invalid project name detected: '$NAME'"
|
||||
exit 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user