mirror of
https://github.com/langgenius/dify.git
synced 2025-12-19 14:19:28 +00:00
fix: determine cpu cores determination in baseedpyright-check script on macos (#28058)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
|
||||
|
||||
def is_db_command():
|
||||
def is_db_command() -> bool:
|
||||
if len(sys.argv) > 1 and sys.argv[0].endswith("flask") and sys.argv[1] == "db":
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -8,9 +8,14 @@ cd "$SCRIPT_DIR/.."
|
||||
# Get the path argument if provided
|
||||
PATH_TO_CHECK="$1"
|
||||
|
||||
# run basedpyright checks
|
||||
if [ -n "$PATH_TO_CHECK" ]; then
|
||||
uv run --directory api --dev -- basedpyright --threads $(nproc) "$PATH_TO_CHECK"
|
||||
else
|
||||
uv run --directory api --dev -- basedpyright --threads $(nproc)
|
||||
fi
|
||||
# Determine CPU core count based on OS
|
||||
CPU_CORES=$(
|
||||
if [[ "$(uname -s)" == "Darwin" ]]; then
|
||||
sysctl -n hw.ncpu 2>/dev/null
|
||||
else
|
||||
nproc
|
||||
fi
|
||||
)
|
||||
|
||||
# Run basedpyright checks
|
||||
uv run --directory api --dev -- basedpyright --threads "$CPU_CORES" $PATH_TO_CHECK
|
||||
|
||||
Reference in New Issue
Block a user