Skip to content

Commit 3b581ab

Browse files
committed
Ensure data/stress.csv exists.
1 parent b2fd367 commit 3b581ab

1 file changed

Lines changed: 24 additions & 9 deletions

File tree

scripts/build_wasm.sh

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,20 @@ fi
4747

4848
WHEEL_FILENAME=$(basename "${SIMDEC_WHEEL_PATH}")
4949

50-
# Prepare output directory
51-
OUT_DIR="dist/pyodide"
50+
# Prepare output directory - USE ABSOLUTE PATH
51+
OUT_DIR="${ROOT_DIR}/dist/pyodide"
5252
mkdir -p "${OUT_DIR}/_static"
5353
mkdir -p "${OUT_DIR}/data"
5454
mkdir -p "${OUT_DIR}/panel/data"
5555

5656
# Copy the wheel into the output directory so it's accessible via HTTP
5757
cp "${SIMDEC_WHEEL_PATH}" "${OUT_DIR}/"
5858

59-
echo "Checking file existence..."
60-
ls -R panel/
61-
ls -l dist/*.whl
62-
6359
# Copy the assets to where the Python scripts expect them
6460
mkdir -p panel/_static
6561
if [ -d "docs/_static" ]; then
66-
cp -r docs/_static/* panel/_static/
62+
# Use || true to prevent failure if it's empty
63+
cp -r docs/_static/* panel/_static/ || true
6764
fi
6865

6966
echo "Converting Panel apps to Pyodide worker output..."
@@ -75,11 +72,29 @@ cd "${ROOT_DIR}/panel"
7572
# Bring the wheel into the current folder so we can pass just the filename
7673
cp "${ROOT_DIR}/${SIMDEC_WHEEL_PATH}" .
7774

75+
# Safe file checking that won't trigger set -e
76+
echo "Checking necessary files locally before conversion..."
77+
if [[ ! -f "simdec_app.py" ]]; then echo "Warning: simdec_app.py not found in panel directory!"; fi
78+
if [[ ! -f "sampling.py" ]]; then echo "Warning: sampling.py not found in panel directory!"; fi
79+
80+
# Ensure data/stress.csv exists relative to the current 'panel' dir
81+
if [[ ! -f "data/stress.csv" ]]; then
82+
echo "Warning: panel/data/stress.csv missing."
83+
if [[ -f "../data/stress.csv" ]]; then
84+
echo "Found stress.csv in root. Copying to panel/data..."
85+
mkdir -p data
86+
cp "../data/stress.csv" data/
87+
else
88+
echo "Error: stress.csv not found anywhere! Conversion may fail."
89+
fi
90+
fi
91+
92+
# Run conversion
7893
"${PYTHON_BIN}" -m panel convert \
7994
simdec_app.py \
8095
sampling.py \
8196
--to pyodide-worker \
82-
--out "${ROOT_DIR}/${OUT_DIR}" \
97+
--out "${OUT_DIR}" \
8398
--requirements "${WHEEL_FILENAME}" numpy pandas matplotlib seaborn scipy SALib \
8499
--resources data/stress.csv
85100

@@ -94,7 +109,7 @@ echo "Copying custom index page and static assets..."
94109

95110
# Copy images/thumbnails from docs/_static if they exist
96111
if [ -d "docs/_static" ]; then
97-
cp -r docs/_static/* "${OUT_DIR}/_static/"
112+
cp -r docs/_static/* "${OUT_DIR}/_static/" || true
98113
fi
99114

100115
# Overwrite default index.html with your custom homepage

0 commit comments

Comments
 (0)