Skip to content

Commit

Permalink
Don't generate conda-meta folder by default (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou authored Jan 17, 2025
1 parent 0d5bb0b commit a24f0ae
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/dynload/dynload.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ export async function loadDynlibsFromPackage(
await loadDynlib(prefix, path, global, [auditWheelLibDir], readFileMemoized, Module);
} catch(e) {
// Not preventing the loop to continue
console.error(e);
console.error(`Failed to load dynlib ${path}`, e);
}
}
}
}

function createDynlibFS(
prefix,
Expand Down
8 changes: 5 additions & 3 deletions src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export async function installCondaPackage(
url: string,
FS: any,
untarjs: IUnpackJSAPI,
verbose: boolean
verbose = false,
generateCondaMeta = false
): Promise<TSharedLibs> {
if (!url) {
throw new Error(`There is no file in ${url}`);
Expand Down Expand Up @@ -121,11 +122,12 @@ export async function installCondaPackage(
const condaFiles: FilesData = await untarjs.extractData(condaPackage);
const packageInfoFiles: FilesData =
await untarjs.extractData(packageInfo);
saveCondaMetaFile(packageInfoFiles, newPrefix, FS, verbose);
generateCondaMeta &&
saveCondaMetaFile(packageInfoFiles, newPrefix, FS, verbose);
saveFiles(FS, { ...condaFiles, ...packageInfoFiles }, newPrefix);
installedFiles = condaFiles;
} else {
saveCondaMetaFile(files, newPrefix, FS, verbose);
generateCondaMeta && saveCondaMetaFile(files, newPrefix, FS, verbose);
saveFiles(FS, files, newPrefix);
installedFiles = files;
}
Expand Down
13 changes: 10 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export interface IBootstrapEmpackPackedEnvironmentOptions {
*/
verbose?: boolean;

/**
* Whether to install conda-meta for packages, default to False
*/
generateCondaMeta?: boolean;

/**
* The untarjs API. If not provided, one will be initialized.
*/
Expand All @@ -61,7 +66,8 @@ export interface IBootstrapEmpackPackedEnvironmentOptions {
export const bootstrapEmpackPackedEnvironment = async (
options: IBootstrapEmpackPackedEnvironmentOptions
): Promise<TSharedLibsMap> => {
const { empackEnvMeta, pkgRootUrl, Module, verbose } = options;
const { empackEnvMeta, pkgRootUrl, Module, verbose, generateCondaMeta } =
options;

let untarjs: IUnpackJSAPI;
if (options.untarjs) {
Expand All @@ -86,7 +92,8 @@ export const bootstrapEmpackPackedEnvironment = async (
packageUrl,
Module.FS,
untarjs,
!!verbose
!!verbose,
!!generateCondaMeta
);
})
);
Expand Down Expand Up @@ -171,7 +178,7 @@ export async function loadShareLibs(
}
}

return Promise.all(sharedLibsLoad);
return await Promise.all(sharedLibsLoad);
}

const waitRunDependencies = (Module: any): Promise<void> => {
Expand Down

0 comments on commit a24f0ae

Please sign in to comment.