Skip to content

Commit ccb4030

Browse files
authored
Add pipeline check for missing __init__.py in sonic-xcvrd whl package (#593)
Description Ensure that the pipeline fail to build if sonic-xcvrd whl package is missing init.py file. Motivation and Context The __init__.py file is necessary in each directory to indicate that the directory should be treated as a package. Tools like setuptools and find_packages() rely on the presence of __init__.py files to identify packages and subpackages. Without __init__.py files, the directories will not be included in the package distribution, leading to incomplete or broken packages. By ensuring that each directory contains an __init__.py file, we can create a complete and functional Python wheel package.
1 parent ee4fb9e commit ccb4030

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

azure-pipelines.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,17 @@ jobs:
126126
# Python 3
127127
- ${{ if eq(project.python3, true) }}:
128128
- script: |
129+
set -xe
130+
# Check for missing __init__.py files for sonic-xcvrd
131+
if [ "${{ project.name }}" == "xcvrd" ]; then
132+
XCVRD_WORK_DIR=$(System.DefaultWorkingDirectory)/${{ project.root_dir }}/xcvrd
133+
missing_init_files=$(find $XCVRD_WORK_DIR -type d ! -exec test -e "{}/__init__.py" \; -print)
134+
if [ -n "$missing_init_files" ]; then
135+
echo "Error: The following directories are missing __init__.py files:"
136+
echo "$missing_init_files"
137+
exit 1
138+
fi
139+
fi
129140
pip3 install ".[testing]"
130141
pip3 uninstall --yes sonic-platform-daemons
131142
pytest

sonic-xcvrd/xcvrd/dom/utilities/db/__init__.py

Whitespace-only changes.

sonic-xcvrd/xcvrd/dom/utilities/vdm/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)