-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Script python library builds, update documentation and dependencies (#…
…4640) * Simplify python environment configuration: - Add a build script that includes all of: - compile host python library - creates a virtual environment to use - installs WHL chip file - Updated instructions for building - sudo should not be required for installation (only running) and we should recommend virtual environment usage due to the requirement to clean the package - Added dependency to pygobject and six, removed dependency on pgi * Restyle fixes * Minor update to kick the restyle checker in github * Use `realpath` to output nicer paths and not use .. thoughout * Restyle fixes * Add instruction to ask for Ubuntu 20.10 instead of 20.04 for Raspberry pi * Restyle fixes
- Loading branch information
Showing
4 changed files
with
92 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Copyright (c) 2021 Project CHIP Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
set -e | ||
|
||
echo_green() { | ||
echo -e "\033[0;32m$*\033[0m" | ||
} | ||
|
||
echo_blue() { | ||
echo -e "\033[1;34m$*\033[0m" | ||
} | ||
|
||
echo_bold_white() { | ||
echo -e "\033[1;37m$*\033[0m" | ||
} | ||
|
||
CHIP_ROOT=$(realpath "$(dirname "$0")/..") | ||
OUTPUT_ROOT="$CHIP_ROOT/out/python_lib" | ||
ENVIRONMENT_ROOT="$CHIP_ROOT/out/python_env" | ||
|
||
# Ensure we have a compilation environment | ||
source "$CHIP_ROOT/scripts/activate.sh" | ||
|
||
# Generates ninja files | ||
gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" | ||
|
||
# Compiles python files | ||
ninja -C "$OUTPUT_ROOT" python | ||
|
||
# Create a virtual environment that has access to the built python tools | ||
virtualenv --clear "$ENVIRONMENT_ROOT" | ||
|
||
# Activate the new enviroment to register the python WHL | ||
source "$ENVIRONMENT_ROOT"/bin/activate | ||
"$ENVIRONMENT_ROOT"/bin/python -m pip install --upgrade pip | ||
"$ENVIRONMENT_ROOT"/bin/pip install "$OUTPUT_ROOT"/controller/python/chip-*.whl | ||
|
||
RELATIVE_ENVIRONMENT_ROOT=$(realpath --relative-to "$PWD" "$ENVIRONMENT_ROOT") | ||
|
||
echo "" | ||
echo_green "Compilation completed and WHL package installed in: " | ||
echo_blue " $RELATIVE_ENVIRONMENT_ROOT" | ||
echo "" | ||
echo_green "To use please run:" | ||
echo_bold_white " source $RELATIVE_ENVIRONMENT_ROOT/bin/activate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters