Skip to content

Commit

Permalink
adapt pip install option based on system and distro.
Browse files Browse the repository at this point in the history
Signed-off-by: Tomoya Fujita <[email protected]>
  • Loading branch information
fujitatomoya committed May 4, 2024
1 parent 462995b commit 685deb8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
10 changes: 9 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ RUN apt-get update \
pip curl\
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
RUN pip install openai

# Adapt pip install option based on distro (technically ubuntu version)
RUN if [ "$ROS_DISTRO" = "humble" ]; then \
pip install openai; \
elif [ "$ROS_DISTRO" = "iron" ]; then \
pip install openai; \
else \
pip install openai --break-system-packages; \
fi

# Build and source colcon workspace
RUN cd $COLCON_WS \
Expand Down
14 changes: 13 additions & 1 deletion scripts/github_workflows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,23 @@ function exit_trap() {
fi
}

function get_ubuntu_version () {
trap exit_trap ERR
echo "[${FUNCNAME[0]}]: get ubuntu version."
UBUNTU_VERSION=$(grep '^VERSION_ID=' /etc/os-release | awk -F'=' '{print $2}' | tr -d '"')
}

function install_prerequisites () {
trap exit_trap ERR
echo "[${FUNCNAME[0]}]: update and install dependent packages."
apt update && apt upgrade -y
# TODO@fujitatomoya: should install openai via package.xml
apt install -y pip
pip install openai --break-system-packages
if [ $UBUNTU_VERSION == "24.04" ]; then
pip install openai --break-system-packages
else
pip install openai
fi
#apt install -y ros-${ROS_DISTRO}-desktop --no-install-recommends
cd $there
}
Expand Down Expand Up @@ -61,6 +71,7 @@ function build_colcon_package () {

export DEBIAN_FRONTEND=noninteractive
export COLCON_WORKSPACE=/tmp/colcon_ws
export UBUNTU_VERSION=24.04

# mark the working space root directory, so that we can come back anytime with `cd $there`
mark there
Expand All @@ -69,6 +80,7 @@ mark there
trap exit_trap ERR

# call install functions in sequence
get_ubuntu_version
install_prerequisites
setup_build_colcon_env
build_colcon_package
Expand Down

0 comments on commit 685deb8

Please sign in to comment.