mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-27 18:50:41 +00:00
ci: add python package build test (#2457)
# What does this PR do? We now test a package build on every PRs. Closes: https://github.com/meta-llama/llama-stack/issues/2406 Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
fa1d986f72
commit
c20388c424
12 changed files with 143 additions and 0 deletions
45
scripts/check-init-py.sh
Executable file
45
scripts/check-init-py.sh
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
#
|
||||
# Check for missing __init__.py files in Python packages
|
||||
# This script finds directories that contain Python files but are missing __init__.py
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Use mapfile to get a faster way to iterate over directories
|
||||
if (( BASH_VERSINFO[0] < 4 )); then
|
||||
echo "This script requires Bash 4.0 or higher for mapfile support."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PACKAGE_DIR="${1:-llama_stack}"
|
||||
|
||||
if [ ! -d "$PACKAGE_DIR" ]; then
|
||||
echo "ERROR: Package directory '$PACKAGE_DIR' does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get all directories with Python files (excluding __init__.py)
|
||||
mapfile -t py_dirs < <(
|
||||
find "$PACKAGE_DIR" \
|
||||
-type f \
|
||||
-name "*.py" ! -name "__init__.py" \
|
||||
! -path "*/.venv/*" \
|
||||
-exec dirname {} \; | sort -u
|
||||
)
|
||||
|
||||
missing_init_files=0
|
||||
|
||||
for dir in "${py_dirs[@]}"; do
|
||||
if [ ! -f "$dir/__init__.py" ]; then
|
||||
echo "ERROR: Missing __init__.py in directory: $dir"
|
||||
echo "This directory contains Python files but no __init__.py, which may cause packaging issues."
|
||||
missing_init_files=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit $missing_init_files
|
Loading…
Add table
Add a link
Reference in a new issue