diff --git a/CHANGELOG.md b/CHANGELOG.md index 218ee85..bc74158 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ Bug-fixes within the same version aren't needed ## Master --> +### 0.1.24 + +* Use arm64 micromamba for Linux + ### 0.1.23 * Fix error when missing name in the environment file diff --git a/src/micromamba/downloadMicromamba.ts b/src/micromamba/downloadMicromamba.ts index b2577e8..a400915 100644 --- a/src/micromamba/downloadMicromamba.ts +++ b/src/micromamba/downloadMicromamba.ts @@ -7,6 +7,10 @@ import { URL } from 'url' import sh from '../sh' import * as os from 'os' +// See: https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html#linux-and-macos + +const arch = os.arch() + export const _downloadMicromamba = async (url: string, tar: Writable): Promise => { try { await _downloadMicromamba1(url, tar) @@ -55,22 +59,18 @@ export const downloadMicromambaWin = async (cwd: string): Promise => { await _downloadMicromamba(url, stream) } -const makeMacDownloadArch = (): string => { - const arch = os.arch() - switch (arch) { - case 'x64': - return '64' - - case 'arm64': - return arch - - default: - throw new Error(`${arch} CPU architecture is not supported by micromamba`) - } -} - export const downloadMicromambaMac = async (cwd: string): Promise => { - const url = `https://micromamba.snakepit.net/api/micromamba/osx-${makeMacDownloadArch()}/latest` + function getUrl() { + switch (arch) { + case 'x64': + return `https://micromamba.snakepit.net/api/micromamba/osx-64/latest` + case 'arm64': + return `https://micromamba.snakepit.net/api/micromamba/osx-arm64/latest` + default: + throw new Error(`${arch} CPU architecture is not supported by micromamba`) + } + } + const url = getUrl() const stream = tar.x({ cwd, strip: 1 }, ['bin/micromamba']) await _downloadMicromamba(url, stream) await sh.chmodR('755', cwd) @@ -78,7 +78,19 @@ export const downloadMicromambaMac = async (cwd: string): Promise => { } export const downloadMicromambaLinux = async (cwd: string): Promise => { - const url = 'https://micromamba.snakepit.net/api/micromamba/linux-64/latest' + function getUrl() { + switch (arch) { + case 'x64': + return `https://micromamba.snakepit.net/api/micromamba/linux-64/latest` + case 'arm64': + return `https://micromamba.snakepit.net/api/micromamba/linux-aarch64/latest` + case 'ppc64': + return `https://micromamba.snakepit.net/api/micromamba/linux-ppc64le/latest` + default: + throw new Error(`${arch} CPU architecture is not supported by micromamba`) + } + } + const url = getUrl() const stream = tar.x({ cwd, strip: 1 }, ['bin/micromamba']) await _downloadMicromamba(url, stream) await sh.chmodR('755', cwd)