Skip to content

Commit

Permalink
update scripts and documentation to install system package dependenci…
Browse files Browse the repository at this point in the history
…es without downloading Drake locally
  • Loading branch information
tyler-yankee committed Jan 21, 2025
1 parent d5f2c75 commit 7fef787
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 135 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: pip setup
working-directory: drake_pip
run: setup/install_prereqs
shell: zsh -efuo pipefail {0}
- name: pip build and test
working-directory: drake_pip
run: .github/ci_build_test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/poetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
python-version: '3.12'
- name: poetry setup
working-directory: drake_poetry
run: .github/macos_setup
run: setup/install_prereqs
shell: zsh -efuo pipefail {0}
- name: poetry build and test
working-directory: drake_poetry
Expand Down
4 changes: 0 additions & 4 deletions drake_pip/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: pip setup
working-directory: drake_pip
run: setup/install_prereqs
shell: zsh -efuo pipefail {0}
- name: pip build and test
working-directory: drake_pip
run: .github/ci_build_test
Expand Down
4 changes: 2 additions & 2 deletions drake_pip/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Python Project with Drake Installed from pip
# Python Project with Drake Installed from Pip

This installs Drake using [`pip`](https://pypi.org/project/pip/), the Python package manager.

## Instructions

First, install the required packages:
First, install the required Ubuntu packages (this step is not needed on Mac):

```
setup/install_prereqs
Expand Down
86 changes: 29 additions & 57 deletions drake_pip/setup/install_prereqs
Original file line number Diff line number Diff line change
Expand Up @@ -36,63 +36,35 @@ if [[ "${EUID}" -ne 0 ]]; then
maybe_sudo=sudo
fi

case "$OSTYPE" in
darwin*)
# Mac specific installations
if [[ "${EUID}" -eq 0 ]]; then
echo 'This script must NOT be run as root' >&2
exit 1
fi
# Ubuntu-specific installations
${maybe_sudo} apt-get update
${maybe_sudo} apt-get install --no-install-recommends lsb-release

if [[ ! -d /opt/drake ]]; then
${maybe_sudo} mkdir -p /opt/drake
${maybe_sudo} chmod g+rwx /opt/drake
${maybe_sudo} chown "${USER}" /opt/drake
${maybe_sudo} chgrp admin /opt/drake
fi

# Install Drake dependencies.
curl -o drake.tar.gz https://drake-packages.csail.mit.edu/drake/nightly/drake-latest-mac-arm64.tar.gz
trap 'rm -f drake.tar.gz' EXIT
tar -xf drake.tar.gz -C /opt
;;

linux*)
# Ubuntu specific installations
if [[ "${EUID:-}" -ne 0 ]]; then
echo 'This script must be run as root' >&2
exit 2
fi

${maybe_sudo} apt-get update
${maybe_sudo} apt-get install --no-install-recommends lsb-release

if [[ "$(lsb_release -sc)" != 'jammy' ]]; then
echo 'This script requires Ubuntu 22.04 (Jammy)' >&2
exit 3
fi

${maybe_sudo} apt-get install --no-install-recommends $(cat <<EOF
ca-certificates
wget
# Jammy and Noble have slightly different package versions needed
# (libglib2.0-0 vs. libglib2.0-0t64)
if [[ "$(lsb_release -sc)" == 'jammy' ]]; then
${maybe_sudo} apt-get update
${maybe_sudo} apt-get install --no-install-recommends $(cat <<EOF
python3-all-dev
libegl1
libx11-6
libsm6
libglib2.0-0
pipx
EOF
)

wget -O drake.tar.gz \
https://drake-packages.csail.mit.edu/drake/nightly/drake-latest-jammy.tar.gz
trap 'rm -f drake.tar.gz' EXIT
tar -xf drake.tar.gz -C /opt

${maybe_sudo} apt-get update
${maybe_sudo} apt-get install --no-install-recommends $(cat <<EOF
python3-all-dev
python3.10-venv
)
elif [[ "$(lsb_release -sc)" == 'noble' ]]; then
${maybe_sudo} apt-get update
${maybe_sudo} apt-get install --no-install-recommends $(cat <<EOF
python3-all-dev
libegl1
libx11-6
libsm6
libglib2.0-0t64
pipx
EOF
)
;;
esac

# Show version for debugging; use echo for newline / readability.
echo -e "\ndrake VERSION.TXT: $(cat /opt/drake/share/doc/drake/VERSION.TXT)\n"

/opt/drake/share/drake/setup/install_prereqs
)
else
echo 'This script requires Ubuntu 22.04 (Jammy) or 24.04 (Noble)' >&2
exit 3
fi
9 changes: 0 additions & 9 deletions drake_poetry/.github/macos_setup

This file was deleted.

5 changes: 1 addition & 4 deletions drake_poetry/.github/ubuntu_setup
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90-get-assume-yes

export DEBIAN_FRONTEND='noninteractive'

setup/install_prereqs

pipx install poetry
pipx ensurepath
setup/install_prereqs
2 changes: 1 addition & 1 deletion drake_poetry/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
python-version: '3.12'
- name: poetry setup
working-directory: drake_poetry
run: .github/macos_setup
run: setup/install_prereqs
shell: zsh -efuo pipefail {0}
- name: poetry build and test
working-directory: drake_poetry
Expand Down
8 changes: 4 additions & 4 deletions drake_poetry/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Python Project with Drake Installed from pip
# Python Project with Drake Installed from Poetry

This installs Drake using [`poetry`](https://python-poetry.org/), the Python package manager.

For an introduction to `poetry`, see [Basic usage](https://python-poetry.org/docs/basic-usage/).

## Instructions

First, install the required packages:
First, install the required packages. This includes an installation of Poetry using `pipx`;
see the [Installation Instructions](https://python-poetry.org/docs/#installation) for
more information.

```
setup/install_prereqs
```

Additionally, install `poetry` following the [Installation Instructions](https://python-poetry.org/docs/#installation).

Call `poetry init` to create project in the current directory, including the following arguments:

* `--python [version]` to introduce a requirement on the version(s)
Expand Down
80 changes: 31 additions & 49 deletions drake_poetry/setup/install_prereqs
Original file line number Diff line number Diff line change
Expand Up @@ -38,64 +38,46 @@ fi

case "$OSTYPE" in
darwin*)
# Mac specific installations
if [[ "${EUID}" -eq 0 ]]; then
echo 'This script must NOT be run as root' >&2
exit 1
fi

if [[ ! -d /opt/drake ]]; then
${maybe_sudo} mkdir -p /opt/drake
${maybe_sudo} chmod g+rwx /opt/drake
${maybe_sudo} chown "${USER}" /opt/drake
${maybe_sudo} chgrp admin /opt/drake
fi

# Install Drake dependencies.
curl -o drake.tar.gz https://drake-packages.csail.mit.edu/drake/nightly/drake-latest-mac-arm64.tar.gz
trap 'rm -f drake.tar.gz' EXIT
tar -xf drake.tar.gz -C /opt

# Mac-specific installations
brew install pipx

;;

linux*)
# Ubuntu specific installations
if [[ "${EUID:-}" -ne 0 ]]; then
echo 'This script must be run as root' >&2
exit 2
fi

# Ubuntu-specific installations
${maybe_sudo} apt-get update
${maybe_sudo} apt-get install --no-install-recommends lsb-release

if [[ "$(lsb_release -sc)" != 'jammy' ]]; then
echo 'This script requires Ubuntu 22.04 (Jammy)' >&2
exit 3
fi

apt-get install --no-install-recommends $(cat <<EOF
ca-certificates
wget
# Jammy and Noble have slightly different package versions needed
# (libglib2.0-0 vs. libglib2.0-0t64)
if [[ "$(lsb_release -sc)" == 'jammy' ]]; then
${maybe_sudo} apt-get update
${maybe_sudo} apt-get install --no-install-recommends $(cat <<EOF
python3-all-dev
libegl1
libx11-6
libsm6
libglib2.0-0
pipx
EOF
)

wget -O drake.tar.gz \
https://drake-packages.csail.mit.edu/drake/nightly/drake-latest-jammy.tar.gz
trap 'rm -f drake.tar.gz' EXIT
tar -xf drake.tar.gz -C /opt

${maybe_sudo} apt-get update
${maybe_sudo} apt-get install --no-install-recommends $(cat <<EOF
python3-all-dev
pipx
)
elif [[ "$(lsb_release -sc)" == 'noble' ]]; then
${maybe_sudo} apt-get update
${maybe_sudo} apt-get install --no-install-recommends $(cat <<EOF
python3-all-dev
libegl1
libx11-6
libsm6
libglib2.0-0t64
pipx
EOF
)
)
else
echo 'This script requires Ubuntu 22.04 (Jammy) or 24.04 (Noble)' >&2
exit 3
fi
;;
esac

# Show version for debugging; use echo for newline / readability.
echo -e "\ndrake VERSION.TXT: $(cat /opt/drake/share/doc/drake/VERSION.TXT)\n"

/opt/drake/share/drake/setup/install_prereqs
# Install poetry and put it on PATH
pipx install poetry
pipx ensurepath

0 comments on commit 7fef787

Please sign in to comment.