Skip to content

Commit

Permalink
Indent nested ifs and cleanup a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Nov 17, 2024
1 parent 1e6496b commit 95976ec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
26 changes: 11 additions & 15 deletions constructor/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,7 @@ boundary1=$(( boundary0 + {{ first_payload_size }} ))
boundary2=$(( boundary1 + {{ second_payload_size }} ))

# verify the MD5 sum of the tarball appended to this header
{%- if osx %}
MD5=$(extract_range "${boundary0}" "${boundary2}" | md5)
{%- else %}
MD5=$(extract_range "${boundary0}" "${boundary2}" | md5sum -)
{%- endif %}
MD5=$(extract_range "${boundary0}" "${boundary2}" | {{ "md5" if osx else "md5sum -" }})
if ! echo "$MD5" | grep {{ installer_md5 }} >/dev/null; then
printf "WARNING: md5sum mismatch of tar archive\\n" >&2
Expand Down Expand Up @@ -496,11 +492,11 @@ if [ "$SKIP_SCRIPTS" = "1" ]; then
printf "WARNING: skipping pre_install.sh by user request\\n" >&2
else
export INST_OPT=''
{%- if direct_execute_pre_install %}
{%- if direct_execute_pre_install %}
if ! "$PREFIX/pkgs/pre_install.sh"; then
{%- else %}
{%- else %}
if ! sh "$PREFIX/pkgs/pre_install.sh"; then
{%- endif %}
{%- endif %}
printf "ERROR: executing pre_install.sh failed\\n" >&2
exit 1
fi
Expand Down Expand Up @@ -560,19 +556,19 @@ for env_pkgs in "${PREFIX}"/pkgs/envs/*/; do
else
env_channels="{{ channels }}"
fi
{%- if enable_shortcuts == "true" %}
{%- if enable_shortcuts == "true" %}
if [ "$SKIP_SHORTCUTS" = "1" ]; then
env_shortcuts="--no-shortcuts"
else
# This file is guaranteed to exist, even if empty
env_shortcuts=$(cat "${env_pkgs}shortcuts.txt")
rm -f "${env_pkgs}shortcuts.txt"
fi
{%- elif enable_shortcuts == "false" %}
{%- elif enable_shortcuts == "false" %}
env_shortcuts="--no-shortcuts"
{%- elif enable_shortcuts == "incompatible" %}
{%- elif enable_shortcuts == "incompatible" %}
env_shortcuts=""
{%- endif %}
{%- endif %}
# shellcheck disable=SC2086
CONDA_ROOT_PREFIX="$PREFIX" \
CONDA_REGISTER_ENVS="{{ register_envs }}" \
Expand Down Expand Up @@ -601,11 +597,11 @@ export TMP="$TMP_BACKUP"
if [ "$SKIP_SCRIPTS" = "1" ]; then
printf "WARNING: skipping post_install.sh by user request\\n" >&2
else
{%- if direct_execute_post_install %}
{%- if direct_execute_post_install %}
if ! "$PREFIX/pkgs/post_install.sh"; then
{%- else %}
{%- else %}
if ! sh "$PREFIX/pkgs/post_install.sh"; then
{%- endif %}
{%- endif %}
printf "ERROR: executing post_install.sh failed\\n" >&2
exit 1
fi
Expand Down
17 changes: 9 additions & 8 deletions constructor/nsis/main.nsi.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,9 @@ Function .onInit
${IfNot} ${UAC_IsAdmin}
MessageBox MB_ICONSTOP "Installation for all users requires an elevated prompt."
Abort
${EndIF}
${EndIF}
${EndIF}
${EndIf}
${EndIf}
${EndIf}

; /D was not used, add default based on install type
${If} $InstDir == ""
Expand All @@ -688,14 +688,15 @@ Function .onInit
# Override custom options with explicitly given values from contruct.yaml.
# If initialize_by_default (register_python_default) is None, do nothing.
{%- if initialize_conda %}
{%- if initialize_by_default %}
{%- if initialize_by_default %}
${If} $InstMode == ${JUST_ME}
StrCpy $Ana_AddToPath_State ${BST_CHECKED}
${EndIF}
{%- else %}
${EndIf}
{%- else %}
StrCpy $Ana_AddToPath_State ${BST_UNCHECKED}
{%- endif %}
{%- endif %}
{%- endif %}

{%- if register_python %}
StrCpy $Ana_RegisterSystemPython_State {{ '${BST_CHECKED}' if register_python_default else '${BST_UNCHECKED}' }}
{%- endif %}
Expand Down Expand Up @@ -997,7 +998,7 @@ Function OnDirectoryLeave
{%- if check_path_spaces %}
StrCpy $R8 "$R8Please remove the space$R1 from the destination folder."
StrCpy $R9 "Error"
#else
{%- else %}
StrCpy $R8 "$R8Please consider removing the space$R1."
StrCpy $R9 "Warning"
{%- endif %}
Expand Down

0 comments on commit 95976ec

Please sign in to comment.