Skip to content

Commit

Permalink
Fixes to custom deps (home-assistant#422)
Browse files Browse the repository at this point in the history
* Fix spelling

* Cleanup up custom_deps/run.sh

* Disable sheelcheck warning

* Update run.sh

* Update CHANGELOG.md

* Update config.json

* Create build.json

* Update Dockerfile
  • Loading branch information
georgemarshall authored and pvizeli committed Oct 10, 2018
1 parent c7cbeb6 commit 446dd8d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
7 changes: 5 additions & 2 deletions custom_deps/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Changelog

## 1
- Bug fix multiple pip packages v2

## 0.3
- Bugfix multible pip packages
- Bug fix multiple pip packages

## 0.2
- Bugfix pip prefix settings
- Bug fix pip prefix settings

## 0.1
- Initial release
2 changes: 1 addition & 1 deletion custom_deps/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV LANG C.UTF-8

# Setup base
RUN apk add --no-cache \
jq python3 gcc g++ make cmake git python3-dev
gcc g++ make cmake git

# Copy data
COPY run.sh /
Expand Down
2 changes: 1 addition & 1 deletion custom_deps/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Custom deps deployment",
"version": "0.3",
"version": "1",
"slug": "custom_deps",
"description": "Manage custom python modules in Home Assistant deps",
"url": "https://home-assistant.io/addons/custom_deps/",
Expand Down
17 changes: 9 additions & 8 deletions custom_deps/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@ set -e

CONFIG_PATH=/data/options.json

PYPI="$(jq --raw-output '.pypi | join(" ")' $CONFIG_PATH)"
APK="$(jq --raw-output '.apk | join(" ") // empty' $CONFIG_PATH)"
PYPI="$(jq --raw-output '.pypi | join(" ")' ${CONFIG_PATH})"
APK="$(jq --raw-output '.apk | join(" ") // empty' ${CONFIG_PATH})"

# Cleanup old deps
echo "[Info] Remove old deps"
rm -rf /config/deps/*

# Need custom apk for build?
if [ -n "$APK" ]; then
if [ -n "${APK}" ]; then
echo "[Info] Install apks for build"
if ! ERROR="$(apk add --no-cache "${APK[@]}")"; then
# shellcheck disable=SC2086
if ! ERROR="$(apk add --no-cache ${APK})"; then
echo "[Error] Can't install packages!"
echo "$ERROR" && exit 1
echo "${ERROR}" && exit 1
fi
fi

Expand All @@ -24,9 +25,9 @@ echo "[Info] Install pypi modules into deps"
export PYTHONUSERBASE=/config/deps

# shellcheck disable=SC2086
if ! ERROR="$(pip3 install --user --no-cache-dir --prefix= --no-dependencies $PYPI)"; then
echo "[Error] Can't install pypi packages!"
echo "$ERROR" && exit 1
if ! ERROR="$(pip3 install --user --no-cache-dir --prefix= --no-dependencies ${PYPI})"; then
echo "[Error] Can't install PyPI packages!"
echo "${ERROR}" && exit 1
fi

echo "[Info] done"

0 comments on commit 446dd8d

Please sign in to comment.