diff --git a/Dockerfile b/Dockerfile index 86cf944..c8305ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,8 +33,12 @@ RUN \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* +#Copy .vscode, pylint, pyproject.toml, etc. +COPY container_content ./container_content + +#Install default requirements COPY requirements.txt ./ -RUN pip3 install -r requirements.txt --use-deprecated=legacy-resolver -RUN rm -rf requirements.txt +RUN pip3 install -r requirements.txt --use-deprecated=legacy-resolver; rm -rf requirements.txt -COPY container_content /tmp/container_content +#Ensure setup.sh is executable +RUN chmod +x /container_content/scripts/setup.sh diff --git a/container_content/.gitattributes b/container_content/.gitattributes deleted file mode 100644 index eca98fc..0000000 --- a/container_content/.gitattributes +++ /dev/null @@ -1,13 +0,0 @@ -# Ensure Docker script files uses LF to support Docker for Windows. -# Ensure "git config --global core.autocrlf input" before you clone -* text eol=lf -*.py whitespace=error - -*.ico binary -*.jpg binary -*.png binary -*.zip binary -*.mp3 binary -*.pcm binary - -Dockerfile.dev linguist-language=Dockerfile diff --git a/container_content/.gitignore b/container_content/.gitignore deleted file mode 100644 index 8a4154e..0000000 --- a/container_content/.gitignore +++ /dev/null @@ -1,134 +0,0 @@ -/config -config2/* - -tests/testing_config/deps -tests/testing_config/home-assistant.log* - -# hass-release -data/ -.token - -# Translations -homeassistant/components/*/translations - -# Hide sublime text stuff -*.sublime-project -*.sublime-workspace - -# Hide some OS X stuff -.DS_Store -.AppleDouble -.LSOverride -Icon - -# Thumbnails -._* - -# IntelliJ IDEA -.idea -*.iml - -# pytest -.pytest_cache -.cache - -# GITHUB Proposed Python stuff: -*.py[cod] - -# C extensions -*.so - -# Packages -*.egg -*.egg-info -dist -build -eggs -.eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg -lib -lib64 -pip-wheel-metadata - -# Logs -*.log -pip-log.txt - -# Unit test / coverage reports -.coverage -coverage.xml -nosetests.xml -htmlcov/ -test-reports/ -test-results.xml -test-output.xml -pytest-*.txt - -# Translations -*.mo - -# Mr Developer -.mr.developer.cfg -.project -.pydevproject - -.python-version - -# emacs auto backups -*~ -*# -*.orig - -# venv stuff -pyvenv.cfg -pip-selfcheck.json -venv -.venv -Pipfile* -share/* -/Scripts/ - -# vimmy stuff -*.swp -*.swo -tags -ctags.tmp - -# vagrant stuff -virtualization/vagrant/setup_done -virtualization/vagrant/.vagrant -virtualization/vagrant/config - -# Visual Studio Code -.vscode/* -!.vscode/cSpell.json -!.vscode/extensions.json -!.vscode/tasks.json -.env - -# Windows Explorer -desktop.ini -/home-assistant.pyproj -/home-assistant.sln -/.vs/* - -# mypy -/.mypy_cache/* -/.dmypy.json - -# Secrets -.lokalise_token - -# monkeytype -monkeytype.sqlite3 - -# This is left behind by Azure Restore Cache -tmp_cache - -# python-language-server / Rope -.ropeproject diff --git a/container_content/.vscode/launch.json b/container_content/.vscode/launch.json deleted file mode 100644 index 5a34faa..0000000 --- a/container_content/.vscode/launch.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "Home Assistant", - "type": "python", - "request": "launch", - "module": "homeassistant", - "justMyCode": false, - "args": [ - "--debug", - "-c", - "/config" - ], - "serverReadyAction": { - "action": "openExternally" - }, - "console": "integratedTerminal" - } - ] -} \ No newline at end of file diff --git a/container_content/.vscode/settings.json b/container_content/.vscode/settings.json deleted file mode 100644 index 3765d12..0000000 --- a/container_content/.vscode/settings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - // Please keep this file in sync with settings in home-assistant/.devcontainer/devcontainer.json - "python.formatting.provider": "black", - // Added --no-cov to work around TypeError: message must be set - // https://github.com/microsoft/vscode-python/issues/14067 - "python.testing.pytestArgs": ["--no-cov"], - // https://code.visualstudio.com/docs/python/testing#_pytest-configuration-settings - "python.testing.pytestEnabled": false -} diff --git a/container_content/.vscode/tasks.json b/container_content/.vscode/tasks.json deleted file mode 100644 index 84803c4..0000000 --- a/container_content/.vscode/tasks.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "Pytest", - "type": "shell", - "command": "pytest --timeout=10 tests", - "dependsOn": [ - "Install all Test Requirements" - ], - "group": { - "kind": "test", - "isDefault": true - }, - "presentation": { - "reveal": "always", - "panel": "new" - }, - "problemMatcher": [] - }, - { - "label": "Pylint", - "type": "shell", - "command": "pylint custom_components", - "dependsOn": [], - "group": { - "kind": "test", - "isDefault": true - }, - "presentation": { - "reveal": "always", - "panel": "new" - }, - "problemMatcher": [] - }, - ] -} \ No newline at end of file diff --git a/container_content/scripts/setup.sh b/container_content/scripts/setup.sh new file mode 100644 index 0000000..1e47e2a --- /dev/null +++ b/container_content/scripts/setup.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Stop on errors +set -e + +echo "Moving additional container content" +[ -f "/container_content/pylint" ] && { rm -R ./pylint; } +mv -f /container_content/pylint . +mv -f /container_content/pyproject.toml . + +echo "Preparing config folder" +mkdir -p /config + +FILE=".devcontainer/configuration.yaml" +[ -f $FILE ] && { echo "Linking configuration.yaml"; ln -sfr $FILE /config/configuration.yaml; } +FILE=".devcontainer/secrets.yaml" +[ -f $FILE ] && { echo "Linking secrets.yaml"; ln -sfr $FILE /config/secrets.yaml; } + +echo "Linking custom_components" +rm -rf /config/custom_components +ln -sfr custom_components /config/custom_components + +# Extract .vscode, pylint, pyproject.toml, setup.cfg +#rsync -a -v --remove-source-files /tmp/container_content/ ./ + +FILE="requirements_component.txt" +[ -f $FILE ] && { echo "Installing requirements from requirements_component.txt"; pip3 install -r $FILE --use-deprecated=legacy-resolver; } \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 0b46a3b..0181b02 100644 --- a/requirements.txt +++ b/requirements.txt @@ -142,7 +142,7 @@ ulid-transform==0.9.0 urllib3>=1.26.5,<2 voluptuous-serialize==2.6.0 voluptuous==0.13.1 -webrtc-noise-gain==1.2.3 +#webrtc-noise-gain==1.2.3 yarl==1.9.4 zeroconf==0.131.0