mirror of
https://github.com/actions/setup-python.git
synced 2024-11-26 10:17:48 +00:00
22 lines
580 B
TypeScript
22 lines
580 B
TypeScript
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(cacheDependencyPath);
|
|
case PackageManagers.Pipenv:
|
|
return new PipenvCache(pythonVersion, cacheDependencyPath);
|
|
default:
|
|
throw new Error(`Caching for '${packageManager}' is not supported`);
|
|
}
|
|
}
|