Skip to content

Commit

Permalink
Copy generated mamba.bat to micromamba.bat to workaround cmd.exe Auto… (
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanMabille authored Oct 3, 2024
1 parent 4b9113a commit 617811f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
18 changes: 14 additions & 4 deletions dist/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions dist/post.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-micromamba",
"version": "1.11.0",
"version": "2.0.0",
"private": true,
"description": "Action to setup micromamba",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const inferOptions = (inputs: Inputs): Options => {
// if micromambaUrl is specified, use that, otherwise use micromambaVersion (or 'latest' if not specified)
const micromambaSource = inputs.micromambaUrl
? right(inputs.micromambaUrl)
: left(inputs.micromambaVersion || '1.5.10-0')
: left(inputs.micromambaVersion || 'latest')

// we write to condarc if a condarc file is not already specified
const writeToCondarc = inputs.condarcFile === undefined
Expand Down
15 changes: 15 additions & 0 deletions src/shell-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ const removeMambaInitBlockFromBashProfile = () => {
})
}

const copyMambaBatToMicromambaBat = (options: Options) => {
const mambaBat = path.join(options.micromambaRootPath, 'condabin', 'mamba.bat')
const micromambaBat = path.join(options.micromambaRootPath, 'condabin', 'micromamba.bat')
return fs.copyFile(mambaBat, micromambaBat)
}

export const shellInit = (options: Options, shell: string) => {
core.startGroup(`Initialize micromamba for ${shell}.`)
const rootPrefixFlag = getRootPrefixFlagForInit(options)
Expand All @@ -52,6 +58,15 @@ export const shellInit = (options: Options, shell: string) => {
if (os.platform() === 'linux' && shell === 'bash') {
return command.then(copyMambaInitBlockToBashProfile).finally(core.endGroup)
}

if (os.platform() === 'win32' && shell === 'cmd.exe') {
return command
.then(() => {
return copyMambaBatToMicromambaBat(options)
})
.finally(core.endGroup)
}

return command.finally(core.endGroup)
}

Expand Down

0 comments on commit 617811f

Please sign in to comment.