fix(mem0-plugin): v0.2.2 (#5234)

This commit is contained in:
Kartik
2026-05-22 21:47:14 +05:30
committed by GitHub
parent 53a3998873
commit 16a7702d09
41 changed files with 889 additions and 675 deletions
+25 -7
View File
@@ -11,6 +11,8 @@ REQ_STAMP="${DATA_DIR}/requirements.txt"
mkdir -p "${DATA_DIR}"
LOCKDIR="${DATA_DIR}/.install-lock"
needs_install=false
if [ ! -f "${VENV_DIR}/bin/python3" ]; then
@@ -20,13 +22,29 @@ elif ! diff -q "${REQ_SRC}" "${REQ_STAMP}" >/dev/null 2>&1; then
fi
if [ "${needs_install}" = "true" ]; then
python3 -m venv "${VENV_DIR}" 2>/dev/null || python -m venv "${VENV_DIR}"
"${VENV_DIR}/bin/pip" install --quiet --upgrade pip >/dev/null 2>&1 || true
if "${VENV_DIR}/bin/pip" install --quiet -r "${REQ_SRC}" 2>/dev/null; then
cp "${REQ_SRC}" "${REQ_STAMP}"
if mkdir "${LOCKDIR}" 2>/dev/null; then
# We acquired the lock — proceed with installation
trap 'rmdir "${LOCKDIR}" 2>/dev/null || true' EXIT
python3 -m venv "${VENV_DIR}" 2>/dev/null || python -m venv "${VENV_DIR}"
"${VENV_DIR}/bin/pip" install --quiet --upgrade pip >/dev/null 2>&1 || true
if "${VENV_DIR}/bin/pip" install --quiet -r "${REQ_SRC}" 2>/dev/null; then
cp "${REQ_SRC}" "${REQ_STAMP}"
rm -f "${DATA_DIR}/.install-failed"
else
rm -f "${REQ_STAMP}"
touch "${DATA_DIR}/.install-failed"
echo "mem0 plugin: failed to install Python dependencies" >&2
exit 0
fi
else
rm -f "${REQ_STAMP}"
echo "mem0 plugin: failed to install Python dependencies" >&2
exit 0
# Another process holds the lock — wait up to 60s for it to finish
for i in $(seq 1 60); do
[ ! -d "${LOCKDIR}" ] && break
sleep 1
done
# Check if the other process's install failed
if [ -f "${DATA_DIR}/.install-failed" ]; then
echo "mem0 plugin: dependency installation failed (by another session)" >&2
fi
fi
fi