-
Notifications
You must be signed in to change notification settings - Fork 4
/
requirements.sh
executable file
·30 lines (25 loc) · 1.66 KB
/
requirements.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# Runs pip-compile on the current platform and generates the shared
# requirements.txt
# pip-compile can be obtained via `pip3 install pip-tools`
# On ubuntu, I need it for both python3 and python3.7 (for colab)
# I can use these to build focal:
# docker run -i -t -v $(pwd):/root/mount -w /root/mount robotlocomotion/drake:focal
# export LC_ALL=C.UTF-8 LANG=C.UTF-8; apt update && apt install -y lsb-release python3-pip python3.8 python3-venv; pip3 install --upgrade pip-tools build; python3.8 -m pip install pip-tools
# I can use these to build jammy:
# docker run -i -t -v $(pwd):/root/mount -w /root/mount robotlocomotion/drake:jammy
# export LC_ALL=C.UTF-8 LANG=C.UTF-8; apt update && apt install -y lsb-release python3-pip python3.10 python3-venv; pip3 install --upgrade pip-tools build; python3.10 -m pip install pip-tools
# (Note: running from mac docker crashes if torch is included; it
# works when docker is run from bionic. go figure)
set -euo pipefail
if [[ "${OSTYPE}" == "darwin"* ]]; then
pip-compile mac-requirements.in
elif [[ "$(lsb_release -cs)" == 'focal' ]]; then
python3 -m piptools compile -v focal-requirements.in
else
python3 -m piptools compile -v jammy-requirements.in
fi
echo "# This file is auto-generated by htmlbook/requirements.sh" > requirements.txt
cat mac-requirements.txt | sed -e '/#/d' -e '/^$/d' -e 's/$/ ; sys_platform == "darwin"/' >> requirements.txt
cat focal-requirements.txt | sed -e '/#/d' -e '/^$/d' -e 's/$/; sys_platform == "linux" and python_version <= "3.8" /' >> requirements.txt
cat jammy-requirements.txt | sed -e '/#/d' -e '/^$/d' -e 's/$/; sys_platform == "linux" and python_version > "3.8" /' >> requirements.txt