File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55set -euo pipefail
66
77SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
8- VENV_DIR=" $SCRIPT_DIR /.venv"
8+
9+ # Allow override from env, otherwise default to project-local .venv
10+ DEFAULT_VENV_DIR=" $SCRIPT_DIR /.venv"
11+ VENV_DIR=" ${VENV_DIR:- $DEFAULT_VENV_DIR } "
12+
13+ # If the project path contains ':' (GVFS sftp:host=...), venv creation will fail.
14+ # In that case, place venv in a local cache directory with a safe path.
15+ if [[ " $SCRIPT_DIR " == * :* ]]; then
16+ SAFE_BASE=" ${XDG_CACHE_HOME:- $HOME / .cache} /venvs"
17+ mkdir -p " $SAFE_BASE "
18+
19+ # Use a stable name; add a short hash to avoid collisions across different paths.
20+ if command -v sha1sum > /dev/null 2>&1 ; then
21+ PATH_HASH=" $( printf " %s" " $SCRIPT_DIR " | sha1sum | awk ' {print substr($1,1,10)}' ) "
22+ else
23+ PATH_HASH=" nohash"
24+ fi
25+
26+ VENV_DIR=" $SAFE_BASE /$( basename " $SCRIPT_DIR " ) -$PATH_HASH "
27+ echo " ⚠️ Detected ':' in path ($SCRIPT_DIR ). Using venv at: $VENV_DIR "
28+ fi
929
1030# 1) Create venv if it doesn't exist
1131if [ ! -d " $VENV_DIR " ]; then
@@ -21,3 +41,4 @@ echo "📦 Installing dependencies…"
2141# 3) Run the exporter, forwarding all CLI arguments
2242echo " 🚀 Starting exporter…"
2343" $VENV_DIR /bin/python" " $SCRIPT_DIR /binance_ohlcv_exporter.py" " $@ "
44+
You can’t perform that action at this time.
0 commit comments