mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
Allow to specify global build directory (#6276)
This commit is contained in:
parent
b5e633a2f3
commit
a8ab745479
2 changed files with 9 additions and 2 deletions
|
@ -21,4 +21,10 @@ export PLATFORMIO_PLATFORMS_DIR="${pio_cache_base}/platforms"
|
||||||
export PLATFORMIO_PACKAGES_DIR="${pio_cache_base}/packages"
|
export PLATFORMIO_PACKAGES_DIR="${pio_cache_base}/packages"
|
||||||
export PLATFORMIO_CACHE_DIR="${pio_cache_base}/cache"
|
export PLATFORMIO_CACHE_DIR="${pio_cache_base}/cache"
|
||||||
|
|
||||||
|
# If /build is mounted, use that as the build path
|
||||||
|
# otherwise use path in /config (so that builds aren't lost on container restart)
|
||||||
|
if [[ -d /build ]]; then
|
||||||
|
export ESPHOME_BUILD_PATH=/build
|
||||||
|
fi
|
||||||
|
|
||||||
exec esphome "$@"
|
exec esphome "$@"
|
||||||
|
|
|
@ -38,7 +38,7 @@ from esphome.const import (
|
||||||
__version__ as ESPHOME_VERSION,
|
__version__ as ESPHOME_VERSION,
|
||||||
)
|
)
|
||||||
from esphome.core import CORE, coroutine_with_priority
|
from esphome.core import CORE, coroutine_with_priority
|
||||||
from esphome.helpers import copy_file_if_changed, walk_files
|
from esphome.helpers import copy_file_if_changed, get_str_env, walk_files
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -190,7 +190,8 @@ def preload_core_config(config, result):
|
||||||
CORE.data[KEY_CORE] = {}
|
CORE.data[KEY_CORE] = {}
|
||||||
|
|
||||||
if CONF_BUILD_PATH not in conf:
|
if CONF_BUILD_PATH not in conf:
|
||||||
conf[CONF_BUILD_PATH] = f"build/{CORE.name}"
|
build_path = get_str_env("ESPHOME_BUILD_PATH", "build")
|
||||||
|
conf[CONF_BUILD_PATH] = os.path.join(build_path, CORE.name)
|
||||||
CORE.build_path = CORE.relative_internal_path(conf[CONF_BUILD_PATH])
|
CORE.build_path = CORE.relative_internal_path(conf[CONF_BUILD_PATH])
|
||||||
|
|
||||||
has_oldstyle = CONF_PLATFORM in conf
|
has_oldstyle = CONF_PLATFORM in conf
|
||||||
|
|
Loading…
Reference in a new issue