Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make build_python.sh automatically install run_python_test.py requirements #27510

Merged
merged 7 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ jobs:
- name: Build Apps
run: |
scripts/run_in_build_env.sh './scripts/build_python.sh --install_virtual_env out/venv --include_yamltests'
scripts/run_in_python_env.sh out/venv 'pip install -r scripts/setup/requirements.build.txt'
scripts/run_in_python_env.sh out/venv 'pip install -r scripts/setup/requirements.yaml_tests.txt'
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target linux-x64-chip-tool${CHIP_TOOL_VARIANT}-${BUILD_VARIANT} \
Expand Down Expand Up @@ -424,8 +422,6 @@ jobs:
- name: Build Python REPL and example apps
run: |
scripts/run_in_build_env.sh './scripts/build_python.sh --install_virtual_env out/venv --extra_packages "mobly"'
scripts/run_in_python_env.sh out/venv 'pip install -r scripts/setup/requirements.build.txt'
scripts/run_in_python_env.sh out/venv 'pip install colorama pyasn1 pyasn1_modules'
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test \
Expand Down Expand Up @@ -499,8 +495,6 @@ jobs:
- name: Build Python REPL and example apps
run: |
scripts/run_in_build_env.sh './scripts/build_python.sh --install_virtual_env out/venv'
scripts/run_in_python_env.sh out/venv 'pip install -r scripts/setup/requirements.build.txt'
scripts/run_in_python_env.sh out/venv 'pip install colorama'
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py \
--target darwin-x64-all-clusters-${BUILD_VARIANT}-test \
Expand Down
16 changes: 16 additions & 0 deletions scripts/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ declare chip_mdns
declare case_retry_delta
declare install_virtual_env
declare clean_virtual_env=yes
declare install_pytest_requirements=yes

help() {

Expand All @@ -63,6 +64,8 @@ Input Options:
<path> represents where the virtual environment is to be created.
-c, --clean_virtual_env <yes|no> When installing a virtual environment, create/clean it first.
Defaults to yes.
--include_pytest_deps <yes|no> Install requirements.python_tests.txt.
Defaults to yes.
--extra_packages PACKAGES Install extra Python packages from PyPI
--include_yamltests Whether to install the matter_yamltests wheel.
-z --pregen_dir DIRECTORY Directory where generated zap files have been pre-generated.
Expand Down Expand Up @@ -101,6 +104,10 @@ while (($#)); do
clean_virtual_env=$2
shift
;;
--include_pytest_deps)
install_pytest_requirements=$2
shift
;;
--extra_packages)
extra_packages=$2
shift
Expand Down Expand Up @@ -178,13 +185,22 @@ if [ -n "$install_virtual_env" ]; then

if [ "$clean_virtual_env" = "yes" ]; then
# Create a virtual environment that has access to the built python tools
echo_blue "Creating a clear VirtualEnv in '$ENVIRONMENT_ROOT' ..."
virtualenv --clear "$ENVIRONMENT_ROOT"
elif [ ! -f "$ENVIRONMENT_ROOT"/bin/activate ]; then
echo_blue "Creating a new VirtualEnv in '$ENVIRONMENT_ROOT' ..."
virtualenv "$ENVIRONMENT_ROOT"
fi

source "$ENVIRONMENT_ROOT"/bin/activate
"$ENVIRONMENT_ROOT"/bin/python -m pip install --upgrade pip
"$ENVIRONMENT_ROOT"/bin/pip install --upgrade "${WHEEL[@]}"

if [ "$install_pytest_requirements" = "yes" ]; then
echo_blue "Installing python test dependencies ..."
"$ENVIRONMENT_ROOT"/bin/pip install -r "$CHIP_ROOT/scripts/setup/requirements.python_tests.txt"
fi

echo ""
echo_green "Compilation completed and WHL package installed in: "
echo_blue " $ENVIRONMENT_ROOT"
Expand Down
16 changes: 16 additions & 0 deletions scripts/setup/requirements.python_tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# scripts/tests
click
colorama
diskcache
websockets

# scripts/py_matter_idl
# TODO: these should be wheel dependencies
lark
jinja2
stringcase

# src/python_testing
mobly
pyasn1
pyasn1_modules
andy31415 marked this conversation as resolved.
Show resolved Hide resolved