Skip to content

Commit

Permalink
use inline conditionals to clean some lines up
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Nov 11, 2024
1 parent 59ceec7 commit 094bb5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 45 deletions.
18 changes: 3 additions & 15 deletions constructor/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,9 @@ THIS_DIR=$(DIRNAME=$(dirname "$0"); cd "$DIRNAME"; pwd)
THIS_FILE=$(basename "$0")
THIS_PATH="$THIS_DIR/$THIS_FILE"
PREFIX="{{ default_prefix }}"
{%- if batch_mode %}
BATCH=1
{%- else %}
BATCH=0
{%- endif %}
BATCH={{ 1 if batch_mode else 0 }}
FORCE=0
{%- if keep_pkgs %}
KEEP_PKGS=1
{%- else %}
KEEP_PKGS=0
{%- endif %}
KEEP_PKGS={{ 1 if keep_pkgs else 0 }}
SKIP_SCRIPTS=0
{%- if enable_shortcuts == "true" %}
SKIP_SHORTCUTS=0
Expand Down Expand Up @@ -644,11 +636,7 @@ fi

if [ "$BATCH" = "0" ]; then
{%- if has_conda and initialize_conda %}
{%- if initialize_by_default %}
DEFAULT=yes
{%- else %}
DEFAULT=no
{%- endif %}
DEFAULT={{ 'yes' if initialize_by_default else 'no' }}
# Interactive mode.

printf "Do you wish to update your shell profile to automatically initialize conda?\\n"
Expand Down
36 changes: 6 additions & 30 deletions constructor/nsis/main.nsi.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,7 @@ FunctionEnd
$\n\
/InstallationType=AllUsers [default: JustMe]$\n\
/AddToPath=[0|1] [default: 0]$\n\
{%- if keep_pkgs %}
/KeepPkgCache=[0|1] [default: 1]$\n\
{%- else %}
/KeepPkgCache=[0|1] [default: 0]$\n\
{%- endif %}
/KeepPkgCache=[0|1] [default: {{ 1 if keep_pkgs else 0 }}]$\n\
/RegisterPython=[0|1] [default: AllUsers: 1, JustMe: 0]$\n\
/NoRegistry=[0|1] [default: AllUsers: 0, JustMe: 0]$\n\
/NoScripts=[0|1] [default: 0]$\n\
Expand Down Expand Up @@ -701,32 +697,12 @@ Function .onInit
{%- endif %}
{%- endif %}
{%- if register_python %}
{%- if register_python_default %}
StrCpy $Ana_RegisterSystemPython_State ${BST_CHECKED}
{%- else %}
StrCpy $Ana_RegisterSystemPython_State ${BST_UNCHECKED}
{%- endif %}
{%- endif %}
{%- if check_path_length %}
StrCpy $CheckPathLength "1"
{%- else %}
StrCpy $CheckPathLength "0"
{%- endif %}
{%- if keep_pkgs %}
StrCpy $Ana_ClearPkgCache_State ${BST_UNCHECKED}
{%- else %}
StrCpy $Ana_ClearPkgCache_State ${BST_CHECKED}
{%- endif %}
{%- if pre_install_exists %}
StrCpy $Ana_PreInstall_State ${BST_CHECKED}
{%- else %}
StrCpy $Ana_PreInstall_State ${BST_UNCHECKED}
{%- endif %}
{%- if post_install_exists %}
StrCpy $Ana_PostInstall_State ${BST_CHECKED}
{%- else %}
StrCpy $Ana_PostInstall_State ${BST_UNCHECKED}
StrCpy $Ana_RegisterSystemPython_State {{ '${BST_CHECKED}' if register_python_default else '${BST_UNCHECKED}' }}
{%- endif %}
StrCpy $CheckPathLength "{{ 1 if check_path_length else 0 }}"
StrCpy $Ana_ClearPkgCache_State {{ '${BST_UNCHECKED}' if keep_pkgs else '${BST_CHECKED}' }}
StrCpy $Ana_PreInstall_State {{ '${BST_CHECKED}' if pre_install_exists else '${BST_UNCHECKED}' }}
StrCpy $Ana_PostInstall_State {{ '${BST_CHECKED}' if post_install_exists else '${BST_UNCHECKED}' }}

Call OnInit_Release

Expand Down

0 comments on commit 094bb5e

Please sign in to comment.