Skip to content

simplify create_pagefile.bat#2569

Merged
h-vetinari merged 1 commit into
conda-forge:mainfrom
h-vetinari:swap
Jun 3, 2026
Merged

simplify create_pagefile.bat#2569
h-vetinari merged 1 commit into
conda-forge:mainfrom
h-vetinari:swap

Conversation

@h-vetinari
Copy link
Copy Markdown
Member

Follow-up to #2562; there's no scenario where "%PageFileDrive%" == "" is ever true, so get rid of the condition for that; also delete a comment about not using delayed expansion, since that script is using delayed expansion. Finally, break up a very long line, at least a little (the rest is a nested invocation, so leave that as-is).

CC @mgorny

@h-vetinari h-vetinari requested a review from a team as a code owner June 3, 2026 03:27
Copy link
Copy Markdown
Contributor

@mgorny mgorny left a comment

Choose a reason for hiding this comment

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

Thanks!

if exist D:\ set "PageFileDrive=D:"
)

:: Only run if PAGEFILE_SIZE is set; EntryPointPath needs to be set outside if-condition when not using EnableDelayedExpansion.
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.

To be honest, I've left that comment in case the file changed in the future, but I'm fine with removing it.

Copy link
Copy Markdown
Member Author

@h-vetinari h-vetinari Jun 3, 2026

Choose a reason for hiding this comment

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

Since we're conditionally setting PageFileDrive, we can never remove delayed expansion here. 🤷

PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%EntryPointPath%' -MinimumSize "%PAGEFILE_SIZE%GB" -MaximumSize "%PAGEFILE_SIZE%GB" -DiskRoot \"%PageFileDrive%\""
)
echo CONDA_BLD_PATH=%CONDA_BLD_PATH%; Setting pagefile size to %PAGEFILE_SIZE% GiB in %PageFileDrive%
REM Inspired by:
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.

BTW do we have an opinion on REM vs :: here?

Copy link
Copy Markdown
Member Author

@h-vetinari h-vetinari Jun 3, 2026

Choose a reason for hiding this comment

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

:: is nicer, but doesn't play well with indentation (of course it's possible to write the script; but it used to lead to warnings and/or weird output; perhaps things have improved...?).

My rule of thumb is: "if unindented, use ::; if indented, use REM"

@h-vetinari h-vetinari merged commit 7ed6300 into conda-forge:main Jun 3, 2026
2 checks passed
@h-vetinari h-vetinari deleted the swap branch June 3, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants