2021-11-17 11:31:22 +01:00
|
|
|
import PipCache from './pip-cache';
|
|
|
|
import PipenvCache from './pipenv-cache';
|
|
|
|
|
|
|
|
export enum PackageManagers {
|
|
|
|
Pip = 'pip',
|
|
|
|
Pipenv = 'pipenv'
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getCacheDistributor(
|
|
|
|
packageManager: string,
|
|
|
|
pythonVersion: string,
|
|
|
|
cacheDependencyPath: string | undefined
|
|
|
|
) {
|
|
|
|
switch (packageManager) {
|
|
|
|
case PackageManagers.Pip:
|
2022-01-31 11:42:08 +01:00
|
|
|
return new PipCache(pythonVersion, cacheDependencyPath);
|
2021-11-17 11:31:22 +01:00
|
|
|
case PackageManagers.Pipenv:
|
|
|
|
return new PipenvCache(pythonVersion, cacheDependencyPath);
|
|
|
|
default:
|
|
|
|
throw new Error(`Caching for '${packageManager}' is not supported`);
|
|
|
|
}
|
|
|
|
}
|