Skip to content

Commit

Permalink
Update dev setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed Mar 25, 2021
1 parent 7ff245d commit ecc458a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
35 changes: 18 additions & 17 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,26 @@ ${pip} install colorlog pre-commit $(grep mypy requirements-dev.txt)

pre-commit install

if [[ -f secrets.yaml ]]; then
GITHUB_TOKEN=$(grep github_token secrets.yaml | cut -d' ' -f2)
# Backup original requirements and insert tokens
FILES=$(ls requirements*)
for FILE in ${FILES}
do
cp ${FILE}{,.bak}
sed -i "s/{GITHUB_TOKEN}/${GITHUB_TOKEN}/g" ${FILE}
REQ=$(cat requirements-dev.txt)
while true; do
FILES=$(echo "${REQ}" | grep "^-r " | sed "s/^-r\\s\+//g")
if test -z "${FILES}"; then
break
fi
for FILE in ${FILES}; do
FILE_R=$(echo "${FILE}" | sed "s/\\./\\\\./g")
REQ=$(echo "${REQ}" | sed -e "/^-r\\s\+${FILE_R}/{r ${FILE}" -e "d" -e "}")
done
fi

${pip} install -r requirements-dev.txt
done
GIT=$(echo "${REQ}" | grep "{GITHUB_TOKEN}" | tr '\r\n' ' ')
REQ=$(echo "${REQ}" | grep -v "{GITHUB_TOKEN}" | tr '\r\n' ' ')

if [[ -f secrets.yaml ]]; then
# Restore original requirements
for FILE in ${FILES}
do
mv -f ${FILE}{.bak,}
done
if test -n "${GIT}"; then
GITHUB_TOKEN=$(grep github_token secrets.yaml | cut -d' ' -f2)
GIT=$(echo "${GIT}" | sed "s/{GITHUB_TOKEN}/${GITHUB_TOKEN}/g")
${pip} install --upgrade ${GIT}
fi

${pip} install --upgrade ${REQ}

echo '"""Custom components module."""' >custom_components/__init__.py
4 changes: 2 additions & 2 deletions custom_components/integration_blueprint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
_LOGGER: logging.Logger = logging.getLogger(__package__)


async def async_setup(hass: HomeAssistant, config: ConfigType):
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up this integration using YAML."""
return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up this integration using UI."""
if hass.data.get(DOMAIN) is None:
hass.data.setdefault(DOMAIN, {})
Expand Down

0 comments on commit ecc458a

Please sign in to comment.