2021-11-17 10:31:22 +00: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 10:42:08 +00:00
|
|
|
return new PipCache(pythonVersion, cacheDependencyPath);
|
2021-11-17 10:31:22 +00:00
|
|
|
case PackageManagers.Pipenv:
|
|
|
|
return new PipenvCache(pythonVersion, cacheDependencyPath);
|
|
|
|
default:
|
|
|
|
throw new Error(`Caching for '${packageManager}' is not supported`);
|
|
|
|
}
|
|
|
|
}
|