mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 15:18:16 +00:00
Merge branch 'dev' into prometheus-climate
This commit is contained in:
commit
41e7b85ca6
@ -35,7 +35,7 @@ RUN \
|
|||||||
iputils-ping=3:20221126-1+deb12u1 \
|
iputils-ping=3:20221126-1+deb12u1 \
|
||||||
git=1:2.39.5-0+deb12u1 \
|
git=1:2.39.5-0+deb12u1 \
|
||||||
curl=7.88.1-10+deb12u8 \
|
curl=7.88.1-10+deb12u8 \
|
||||||
openssh-client=1:9.2p1-2+deb12u3 \
|
openssh-client=1:9.2p1-2+deb12u4 \
|
||||||
python3-cffi=1.15.1-5 \
|
python3-cffi=1.15.1-5 \
|
||||||
libcairo2=1.16.0-7 \
|
libcairo2=1.16.0-7 \
|
||||||
libmagic1=1:5.44-3 \
|
libmagic1=1:5.44-3 \
|
||||||
|
@ -36,7 +36,7 @@ template<typename... Ts> class TotoAction : public RemoteTransmitterActionBase<T
|
|||||||
data.rc_code_2 = this->rc_code_2_.value(x...);
|
data.rc_code_2 = this->rc_code_2_.value(x...);
|
||||||
data.command = this->command_.value(x...);
|
data.command = this->command_.value(x...);
|
||||||
this->set_send_times(this->send_times_.value_or(x..., 3));
|
this->set_send_times(this->send_times_.value_or(x..., 3));
|
||||||
this->set_send_wait(this->send_wait_.value_or(x..., 32000));
|
this->set_send_wait(this->send_wait_.value_or(x..., 36000));
|
||||||
TotoProtocol().encode(dst, data);
|
TotoProtocol().encode(dst, data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import logging
|
import logging
|
||||||
import multiprocessing
|
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@ -94,10 +93,19 @@ def valid_project_name(value: str):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def get_usable_cpu_count() -> int:
|
||||||
|
"""Return the number of CPUs that can be used for processes.
|
||||||
|
On Python 3.13+ this is the number of CPUs that can be used for processes.
|
||||||
|
On older Python versions this is the number of CPUs.
|
||||||
|
"""
|
||||||
|
return (
|
||||||
|
os.process_cpu_count() if hasattr(os, "process_cpu_count") else os.cpu_count()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if "ESPHOME_DEFAULT_COMPILE_PROCESS_LIMIT" in os.environ:
|
if "ESPHOME_DEFAULT_COMPILE_PROCESS_LIMIT" in os.environ:
|
||||||
_compile_process_limit_default = min(
|
_compile_process_limit_default = min(
|
||||||
int(os.environ["ESPHOME_DEFAULT_COMPILE_PROCESS_LIMIT"]),
|
int(os.environ["ESPHOME_DEFAULT_COMPILE_PROCESS_LIMIT"]), get_usable_cpu_count()
|
||||||
multiprocessing.cpu_count(),
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
_compile_process_limit_default = cv.UNDEFINED
|
_compile_process_limit_default = cv.UNDEFINED
|
||||||
@ -156,7 +164,7 @@ CONFIG_SCHEMA = cv.All(
|
|||||||
),
|
),
|
||||||
cv.Optional(
|
cv.Optional(
|
||||||
CONF_COMPILE_PROCESS_LIMIT, default=_compile_process_limit_default
|
CONF_COMPILE_PROCESS_LIMIT, default=_compile_process_limit_default
|
||||||
): cv.int_range(min=1, max=multiprocessing.cpu_count()),
|
): cv.int_range(min=1, max=get_usable_cpu_count()),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
validate_hostname,
|
validate_hostname,
|
||||||
|
@ -14,7 +14,7 @@ esptool==4.7.0
|
|||||||
click==8.1.7
|
click==8.1.7
|
||||||
esphome-dashboard==20250212.0
|
esphome-dashboard==20250212.0
|
||||||
aioesphomeapi==29.1.0
|
aioesphomeapi==29.1.0
|
||||||
zeroconf==0.144.3
|
zeroconf==0.145.1
|
||||||
puremagic==1.27
|
puremagic==1.27
|
||||||
ruamel.yaml==0.18.6 # dashboard_import
|
ruamel.yaml==0.18.6 # dashboard_import
|
||||||
esphome-glyphsets==0.1.0
|
esphome-glyphsets==0.1.0
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import multiprocessing
|
|
||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
import re
|
import re
|
||||||
@ -11,7 +10,13 @@ import threading
|
|||||||
|
|
||||||
import click
|
import click
|
||||||
import colorama
|
import colorama
|
||||||
from helpers import filter_changed, get_binary, git_ls_files, print_error_for_file
|
from helpers import (
|
||||||
|
filter_changed,
|
||||||
|
get_binary,
|
||||||
|
get_usable_cpu_count,
|
||||||
|
git_ls_files,
|
||||||
|
print_error_for_file,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def run_format(executable, args, queue, lock, failed_files):
|
def run_format(executable, args, queue, lock, failed_files):
|
||||||
@ -25,7 +30,9 @@ def run_format(executable, args, queue, lock, failed_files):
|
|||||||
invocation.extend(["--dry-run", "-Werror"])
|
invocation.extend(["--dry-run", "-Werror"])
|
||||||
invocation.append(path)
|
invocation.append(path)
|
||||||
|
|
||||||
proc = subprocess.run(invocation, capture_output=True, encoding="utf-8")
|
proc = subprocess.run(
|
||||||
|
invocation, capture_output=True, encoding="utf-8", check=False
|
||||||
|
)
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
with lock:
|
with lock:
|
||||||
print_error_for_file(path, proc.stderr)
|
print_error_for_file(path, proc.stderr)
|
||||||
@ -45,7 +52,7 @@ def main():
|
|||||||
"-j",
|
"-j",
|
||||||
"--jobs",
|
"--jobs",
|
||||||
type=int,
|
type=int,
|
||||||
default=multiprocessing.cpu_count(),
|
default=get_usable_cpu_count(),
|
||||||
help="number of format instances to be run in parallel.",
|
help="number of format instances to be run in parallel.",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -80,7 +87,8 @@ def main():
|
|||||||
lock = threading.Lock()
|
lock = threading.Lock()
|
||||||
for _ in range(args.jobs):
|
for _ in range(args.jobs):
|
||||||
t = threading.Thread(
|
t = threading.Thread(
|
||||||
target=run_format, args=(executable, args, task_queue, lock, failed_files)
|
target=run_format,
|
||||||
|
args=(executable, args, task_queue, lock, failed_files),
|
||||||
)
|
)
|
||||||
t.daemon = True
|
t.daemon = True
|
||||||
t.start()
|
t.start()
|
||||||
@ -95,7 +103,7 @@ def main():
|
|||||||
# Wait for all threads to be done.
|
# Wait for all threads to be done.
|
||||||
task_queue.join()
|
task_queue.join()
|
||||||
|
|
||||||
except FileNotFoundError as ex:
|
except FileNotFoundError:
|
||||||
return 1
|
return 1
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print()
|
print()
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import multiprocessing
|
|
||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
import re
|
import re
|
||||||
@ -19,6 +18,7 @@ from helpers import (
|
|||||||
filter_changed,
|
filter_changed,
|
||||||
filter_grep,
|
filter_grep,
|
||||||
get_binary,
|
get_binary,
|
||||||
|
get_usable_cpu_count,
|
||||||
git_ls_files,
|
git_ls_files,
|
||||||
load_idedata,
|
load_idedata,
|
||||||
print_error_for_file,
|
print_error_for_file,
|
||||||
@ -170,7 +170,7 @@ def main():
|
|||||||
"-j",
|
"-j",
|
||||||
"--jobs",
|
"--jobs",
|
||||||
type=int,
|
type=int,
|
||||||
default=multiprocessing.cpu_count(),
|
default=get_usable_cpu_count(),
|
||||||
help="number of tidy instances to be run in parallel.",
|
help="number of tidy instances to be run in parallel.",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -188,3 +188,14 @@ def get_binary(name: str, version: str) -> str:
|
|||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
def get_usable_cpu_count() -> int:
|
||||||
|
"""Return the number of CPUs that can be used for processes.
|
||||||
|
|
||||||
|
On Python 3.13+ this is the number of CPUs that can be used for processes.
|
||||||
|
On older Python versions this is the number of CPUs.
|
||||||
|
"""
|
||||||
|
return (
|
||||||
|
os.process_cpu_count() if hasattr(os, "process_cpu_count") else os.cpu_count()
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user