Skip to content

Commit 026676d

Browse files
committed
Fix install_controlplots
1 parent 835458d commit 026676d

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

bin/install_controlplots

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,20 +220,24 @@ if [[ "$_backend" == "system" ]]; then
220220
# PythonCall always uses the system Python when running examples.
221221
_prefs_file="examples/LocalPreferences.toml"
222222
if [[ -f "$_prefs_file" ]]; then
223-
# Remove any existing [PythonCall] and legacy [PyCall] sections.
223+
# Remove any existing [PythonCall], [CondaPkg] and legacy [PyCall] sections.
224224
_tmp=$(mktemp)
225225
awk '
226-
/^\[PythonCall\]/ { in_pc=1; next }
227-
/^\[PyCall\]/ { in_pc=1; next }
228-
in_pc && /^\[/ { in_pc=0 }
229-
!in_pc { print }
226+
/^\[PythonCall\]/ { in_sec=1; next }
227+
/^\[PyCall\]/ { in_sec=1; next }
228+
/^\[CondaPkg\]/ { in_sec=1; next }
229+
in_sec && /^\[/ { in_sec=0 }
230+
!in_sec { print }
230231
' "$_prefs_file" > "$_tmp"
231232
mv "$_tmp" "$_prefs_file"
232233
fi
233234
{
234235
echo ""
235236
echo "[PythonCall]"
236237
echo "exe = \"$_syspython\""
238+
echo ""
239+
echo "[CondaPkg]"
240+
echo "backend = \"Null\""
237241
} >> "$_prefs_file"
238242
echo "Written to $_prefs_file."
239243

@@ -252,14 +256,15 @@ elif [[ "$_backend" == "conda" ]]; then
252256
if [[ -f "$_prefs_file" ]]; then
253257
_tmp=$(mktemp)
254258
awk '
255-
/^\[PythonCall\]/ { in_pc=1; next }
256-
/^\[PyCall\]/ { in_pc=1; next }
257-
in_pc && /^\[/ { in_pc=0 }
258-
!in_pc { print }
259+
/^\[PythonCall\]/ { in_sec=1; next }
260+
/^\[PyCall\]/ { in_sec=1; next }
261+
/^\[CondaPkg\]/ { in_sec=1; next }
262+
in_sec && /^\[/ { in_sec=0 }
263+
!in_sec { print }
259264
' "$_prefs_file" > "$_tmp"
260265
if ! diff -q "$_prefs_file" "$_tmp" &>/dev/null; then
261266
mv "$_tmp" "$_prefs_file"
262-
echo "Removed [PythonCall]/[PyCall] section from $_prefs_file (switching to CondaPkg)."
267+
echo "Removed [PythonCall]/[PyCall]/[CondaPkg] section from $_prefs_file (switching to CondaPkg)."
263268
else
264269
rm -f "$_tmp"
265270
fi

0 commit comments

Comments
 (0)