Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion constructor/winexe.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,21 @@ def make_nsi(
variables["uninstall_with_conda_exe"] = bool(info.get("uninstall_with_conda_exe"))
variables["needs_python_exe"] = info.get("_win_install_needs_python_exe", True)

approx_pkgs_size_kb = approx_size_kb(info, "pkgs")
# - `keep_pkgs: true` + `always_copy: true` = tarballs + 2 * extracted
# - `keep_pkgs: true` + `always_copy: false` = tarballs + extracted
# - `keep_pkgs: false` = extracted only
# `keep_pkgs: true`
if info.get("keep_pkgs", False):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to keep the archives in the size calculation no matter what the value of keep_pkgs is since these files are removed after package installation.

The purpose of the file size calculation is not just to inform the user, but to prevent running out of disk space. So, the value should be the amount of disk space the installer needs for the installation, not what's left in the end.

# tarballs in pkgs/
size_tarballs = info.get("_approx_tarballs_size", 0)
# extracted tarballs in pkgs/<name>/
size_extracted = info.get("_approx_pkgs_size", 0)
# `always_copy: true` in condarc means installed files are copies, not hard links
if info.get("condarc", {}).get("always_copy", False):
size_extracted = 2 * size_extracted

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is correct for an installer that only has a base environment, but not for installers with multiple environments.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understood, let me think harder about it. I can see that this logic worked for my current use-case, but there are others that I have not thought about

approx_pkgs_size_kb = int((size_tarballs + size_extracted) / 1000)
else:
approx_pkgs_size_kb = approx_size_kb(info, "pkgs")

# UPPERCASE variables are unescaped (and unquoted)
variables["CONDA_LOG_ARG"] = (
Expand Down
19 changes: 19 additions & 0 deletions news/1330-disk-size-estimate-updates
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* Adjusts the way that the estimated disk usage is calculated, based on more `construct.yaml` variables. (#1330 via #1331)

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>