Skip to content

Commit

Permalink
use kb everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Jan 26, 2024
1 parent 24998da commit a5acaa9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions constructor/header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,12 @@ if ! mkdir -p "$PREFIX"; then
exit 1
fi

total_installation_size="__TOTAL_INSTALLATION_SIZE__"
free_disk_space="$(df -Pk "$PREFIX" | tail -n 1 | awk '{print $4}')"
free_disk_space_with_buffer="$((free_disk_space - 100 * 1024 * 1024))" # add 100MB of buffer
if [ "$free_disk_space_with_buffer" -lt "$total_installation_size" ]; then
printf "ERROR: Not enough free disk space: %s < %s\\n" "$free_disk_space" "$total_installation_size" >&2
total_installation_size_kb="__TOTAL_INSTALLATION_SIZE_KB__"
free_disk_space_bytes="$(df -Pk "$PREFIX" | tail -n 1 | awk '{print $4}')"
free_disk_space_kb="$(($free_disk_space_bytes / 1024))"
free_disk_space_kb_with_buffer="$((free_disk_space_bytes - 100 * 1024))" # add 100MB of buffer
if [ "$free_disk_space_kb_with_buffer" -lt "$total_installation_size_kb" ]; then
printf "ERROR: Not enough free disk space: %s < %s\\n" "$free_disk_space_kb_with_buffer" "$total_installation_size_kb" >&2
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion constructor/shar.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def get_header(conda_exec, tarball, info):
'pycache': '__pycache__',
'SHORTCUTS': shortcuts_flags(info),
'REGISTER_ENVS': str(info.get("register_envs", True)).lower(),
'TOTAL_INSTALLATION_SIZE': str(approx_size_kb(info, "total")),
'TOTAL_INSTALLATION_SIZE_KB': str(approx_size_kb(info, "total")),
}
if has_license:
replace['LICENSE'] = read_ascii_only(info['license_file'])
Expand Down

0 comments on commit a5acaa9

Please sign in to comment.