mirror of
https://github.com/actions/setup-python.git
synced 2026-01-20 04:38:56 +08:00
add support for caching
This commit is contained in:
parent
feeaa3ba49
commit
952fef3565
14 changed files with 124033 additions and 7678 deletions
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 async function getCacheDistributor(
|
||||
packageManager: string,
|
||||
pythonVersion: string,
|
||||
patterns: string | undefined
|
||||
) {
|
||||
switch (packageManager) {
|
||||
case PackageManagers.Pip:
|
||||
return new PipCache(patterns);
|
||||
case PackageManagers.Pipenv:
|
||||
return new PipenvCache(pythonVersion, patterns);
|
||||
default:
|
||||
throw new Error(`Caching for '${packageManager}' is not supported`);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue