You've already forked setup-python
mirror of
https://github.com/actions/setup-python.git
synced 2025-08-29 17:04:04 +07:00
Implementation of python's caching (#266)
This commit is contained in:
22
src/cache-distributions/cache-factory.ts
Normal file
22
src/cache-distributions/cache-factory.ts
Normal file
@ -0,0 +1,22 @@
|
||||
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`);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user