mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Remove idf components before checking if any in config (#4506)
* Remove idf components before checking if any in config * Fix bug with no refresh time specified
This commit is contained in:
parent
bd86a0ac3b
commit
b8ca40170e
2 changed files with 6 additions and 6 deletions
|
@ -523,11 +523,11 @@ def copy_files():
|
||||||
__version__,
|
__version__,
|
||||||
)
|
)
|
||||||
|
|
||||||
if CORE.data[KEY_ESP32][KEY_COMPONENTS]:
|
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
shutil.rmtree(CORE.relative_build_path("components"), ignore_errors=True)
|
shutil.rmtree(CORE.relative_build_path("components"), ignore_errors=True)
|
||||||
|
|
||||||
|
if CORE.data[KEY_ESP32][KEY_COMPONENTS]:
|
||||||
components: dict = CORE.data[KEY_ESP32][KEY_COMPONENTS]
|
components: dict = CORE.data[KEY_ESP32][KEY_COMPONENTS]
|
||||||
|
|
||||||
for name, component in components.items():
|
for name, component in components.items():
|
||||||
|
|
|
@ -44,7 +44,7 @@ def clone_or_update(
|
||||||
*,
|
*,
|
||||||
url: str,
|
url: str,
|
||||||
ref: str = None,
|
ref: str = None,
|
||||||
refresh: TimePeriodSeconds,
|
refresh: Optional[TimePeriodSeconds],
|
||||||
domain: str,
|
domain: str,
|
||||||
username: str = None,
|
username: str = None,
|
||||||
password: str = None,
|
password: str = None,
|
||||||
|
@ -81,7 +81,7 @@ def clone_or_update(
|
||||||
if not file_timestamp.exists():
|
if not file_timestamp.exists():
|
||||||
file_timestamp = Path(repo_dir / ".git" / "HEAD")
|
file_timestamp = Path(repo_dir / ".git" / "HEAD")
|
||||||
age = datetime.now() - datetime.fromtimestamp(file_timestamp.stat().st_mtime)
|
age = datetime.now() - datetime.fromtimestamp(file_timestamp.stat().st_mtime)
|
||||||
if age.total_seconds() > refresh.total_seconds:
|
if refresh is None or age.total_seconds() > refresh.total_seconds:
|
||||||
old_sha = run_git_command(["git", "rev-parse", "HEAD"], str(repo_dir))
|
old_sha = run_git_command(["git", "rev-parse", "HEAD"], str(repo_dir))
|
||||||
_LOGGER.info("Updating %s", key)
|
_LOGGER.info("Updating %s", key)
|
||||||
_LOGGER.debug("Location: %s", repo_dir)
|
_LOGGER.debug("Location: %s", repo_dir)
|
||||||
|
|
Loading…
Reference in a new issue