Skip to content

Commit dcf73c7

Browse files
committed
install.sh: check for and install requirements-examples.txt.
1 parent 1a8c7ff commit dcf73c7

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ You can optionally run `sudo raspi-config` or the graphical Raspberry Pi Configu
6666
Some of the examples have additional dependencies. You can install them with:
6767

6868
```bash
69-
pip install
70-
```
69+
pip install -r requirements-examples.txt
70+
```

boilerplate.md

+8
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ Press Ctrl+C to exit.
9595
""")
9696
```
9797

98+
If your examples need additional dependencies, then list them in:
99+
100+
```
101+
requirements-examples.txt
102+
```
103+
104+
Otherwise, just delete this file to avoid unnecessarily prompting the user.
105+
98106
## Install / Uninstall Scripts
99107

100108
If your package directory (`PROJECT_NAME/`) differs from your library name, you should update `install.sh` and `uninstall.sh` and hard-code the correct library name.

install.sh

+15
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ function pip_pkg_install {
166166
check_for_error
167167
}
168168

169+
function pip_requirements_install {
170+
# A null Keyring prevents pip stalling in the background
171+
PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring $PYTHON -m pip install -r "$@"
172+
check_for_error
173+
}
174+
169175
while [[ $# -gt 0 ]]; do
170176
K="$1"
171177
case $K in
@@ -335,6 +341,15 @@ fi
335341

336342
printf "\n"
337343

344+
if [ -f "requirements-examples.txt" ]; then
345+
if confirm "Would you like to install example dependencies?"; then
346+
inform "Installing dependencies from requirements-examples.txt..."
347+
pip_requirements_install requirements-examples.txt
348+
fi
349+
fi
350+
351+
printf "\n"
352+
338353
# Use pdoc to generate basic documentation from the installed module
339354

340355
if confirm "Would you like to generate documentation?"; then

0 commit comments

Comments
 (0)