3
0
Fork 0
mirror of https://gitea.com/actions/setup-python.git synced 2024-11-23 02:29:35 +01:00
setup-python/src/cache-distributions/cache-factory.ts

23 lines
595 B
TypeScript
Raw Normal View History

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:
return new PipCache(pythonVersion, cacheDependencyPath);
case PackageManagers.Pipenv:
return new PipenvCache(pythonVersion, cacheDependencyPath);
default:
throw new Error(`Caching for '${packageManager}' is not supported`);
}
}