Skip to content
Merged
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
168 changes: 168 additions & 0 deletions packages/mambajs-core/schema/lock.v1.0.4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
{
"title": "ILockV104",
"type": "object",
"additionalProperties": false,
"required": ["lockVersion", "platform", "specs", "channels", "channelInfo", "packages", "pipPackages"],
"properties": {
"id": {
"type": "string"
},
"lockVersion": {
"type": "string",
"enum": ["1.0.4"]
},
"platform": {
"type": "string",
"enum": [
"noarch",
"unknown",
"linux-32",
"linux-64",
"linux-aarch64",
"linux-armv6l",
"linux-armv7l",
"linux-loongarch64",
"linux-ppc64le",
"linux-ppc64",
"linux-ppc",
"linux-s390x",
"linux-riscv32",
"linux-riscv64",
"freebsd-32",
"freebsd-64",
"freebsd-arm64",
"osx-64",
"osx-arm64",
"win-32",
"win-64",
"win-arm64",
"emscripten-wasm32",
"emscripten-wasm64",
"wasi-wasm32",
"zos-z"
]
},
"specs": {
"type": "array",
"items": {
"type": "string"
}
},
"channels": {
"type": "array",
"items": {
"type": "string"
}
},
"channelInfo": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"type": "array",
"items": {
"type": "object",
"required": ["url", "protocol"],
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"protocol": {
"type": "string",
"enum": ["https"]
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
},
"packages": {
"type": "object",
"patternProperties": {
".*": {
"type": "object",
"required": ["name", "version", "channel"],
"properties": {
"name": {
"type": "string"
},
"build": {
"type": "string"
},
"version": {
"type": "string"
},
"subdir": {
"type": "string"
},
"channel": {
"type": "string"
},
"size": {
"type": "number"
},
"hash": {
"type": "object",
"required": [],
"properties": {
"md5": {
"type": "string"
},
"sha256": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"pipPackages": {
"type": "object",
"patternProperties": {
".*": {
"type": "object",
"required": ["name", "version", "url", "registry"],
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"size": {
"type": "number"
},
"registry": {
"type": "string"
},
"hash": {
"type": "object",
"required": [],
"properties": {
"md5": {
"type": "string"
},
"sha256": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
}
}
11 changes: 7 additions & 4 deletions packages/mambajs-core/src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,13 +532,16 @@ export function formatChannels(
}

if (channel === 'emscripten-forge') {
logger.warn('emscripten-forge channel alias is deprecated. Please use https://prefix.dev/emscripten-forge-3x explicitely.')
logger.warn(
'emscripten-forge channel alias is deprecated. Please use https://prefix.dev/emscripten-forge-3x explicitely.'
);
channel = 'https://prefix.dev/emscripten-forge-3x';
}

if (channel === 'https://prefix.dev/emscripten-forge') {
const error = 'https://prefix.dev/emscripten-forge channel does not exist. Please use https://prefix.dev/emscripten-forge-3x or https://prefix.dev/emscripten-forge-4x explicitely.';
logger.error(error)
const error =
'https://prefix.dev/emscripten-forge channel does not exist. Please use https://prefix.dev/emscripten-forge-3x or https://prefix.dev/emscripten-forge-4x explicitely.';
logger.error(error);
throw new Error(error);
}

Expand Down Expand Up @@ -586,7 +589,7 @@ export function computePackageChannel(
}

throw new Error(
`Failed to detect channel from ${pkg} (${pkg.channel}), with known channels ${formattedChannels.channels}`
`Failed to detect channel from ${pkg.name} (${pkg.channel}), with known channels ${formattedChannels.channels}`
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/mambajs-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export * from './types';
export * from './helper';
export * from './parser';

export const MAMBAJS_LOCK_VERSION = '1.0.3';
export const MAMBAJS_LOCK_VERSION = '1.0.4';

/**
* Given a lock file, get the Python version
Expand Down
3 changes: 2 additions & 1 deletion packages/mambajs-core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { ILock } from './types';
export type { ILockV1 } from './_interface/lock.v1.0.0';
export type { ILockV101 } from './_interface/lock.v1.0.1';
export type { ILockV102 } from './_interface/lock.v1.0.2';
export type { ILockV103 as ILock } from './_interface/lock.v1.0.3';
export type { ILockV103 } from './_interface/lock.v1.0.3';
export type { ILockV104 as ILock } from './_interface/lock.v1.0.4';

export interface ILogger {
log(...msg: any[]): void;
Expand Down
2 changes: 1 addition & 1 deletion packages/mambajs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"typescript": "^5"
},
"dependencies": {
"@conda-org/rattler": "^0.3.5",
"@conda-org/rattler": "^0.4.0",
"@emscripten-forge/mambajs-core": "^0.21.5",
"yaml": "^2.7.0"
}
Expand Down
22 changes: 18 additions & 4 deletions packages/mambajs/src/solver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import {
MAMBAJS_LOCK_VERSION,
parseEnvYml
} from '@emscripten-forge/mambajs-core';
import { Platform, simpleSolve, SolvedPackage } from '@conda-org/rattler';
import {
isRattlerError,
Platform,
simpleSolve,
SolvedPackage
} from '@conda-org/rattler';

export interface ISolveOptions {
ymlOrSpecs?: string | string[];
Expand All @@ -29,7 +34,7 @@ const VIRTUAL_PACKAGES = {
__archspec: makeVirtualPackage('__archspec')
};

function makeVirtualPackage(name: string, version='0') {
function makeVirtualPackage(name: string, version = '0') {
return {
filename: name,
packageName: name,
Expand Down Expand Up @@ -173,7 +178,10 @@ export const solveConda = async (options: ISolveOptions): Promise<ILock> => {
});
} catch (error) {
let message: string = 'Unknown error';
if (typeof error === 'string') {

if (isRattlerError(error)) {
message = `${error.name} ${error.code}: ${error.message}`;
} else if (typeof error === 'string') {
message = error;
} else if (error instanceof Error) {
message = error.message;
Expand All @@ -196,11 +204,17 @@ export const solveConda = async (options: ISolveOptions): Promise<ILock> => {
Object.keys(condaPackages).forEach(filename => {
const pkg = condaPackages[filename];

// Remove virtual package from the result
if (pkg.name in VIRTUAL_PACKAGES) {
delete condaPackages[filename];
return;
}

const channel = computePackageChannel(pkg, formattedChannels);

if (!channel) {
throw new Error(
`Failed to detect channel from ${pkg} (${pkg.channel}), with known channels ${formattedChannels.channels}`
`Failed to detect channel from ${pkg.name} (${pkg.channel}), with known channels ${formattedChannels.channels}`
);
}

Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ __metadata:
languageName: node
linkType: hard

"@conda-org/rattler@npm:^0.3.5":
version: 0.3.5
resolution: "@conda-org/rattler@npm:0.3.5"
checksum: 3f18697c380cf13f91a27bcd2c64eb7ccd3113f7ab104d8f5bc2d5be0ab217e7cf161217de601fd477014629e96c445eadd354d6f5473c117e6d68f8a41440cb
"@conda-org/rattler@npm:^0.4.0":
version: 0.4.0
resolution: "@conda-org/rattler@npm:0.4.0"
checksum: 8ff26333dbba11175e620aea95ae5c9246d1b2b38034fa3957f8065160f95dc0df645e8ec692d0b649f53d9e96d9322229a489e80a750c1df64a934025822187
languageName: node
linkType: hard

Expand Down Expand Up @@ -128,7 +128,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@emscripten-forge/mambajs@workspace:packages/mambajs"
dependencies:
"@conda-org/rattler": ^0.3.5
"@conda-org/rattler": ^0.4.0
"@emscripten-forge/mambajs-core": ^0.21.5
"@esbuild-plugins/node-globals-polyfill": ^0.2.3
"@esbuild-plugins/node-modules-polyfill": ^0.2.2
Expand Down
Loading