mirror of
https://github.com/actions/setup-python.git
synced 2025-07-19 12:18:21 +02:00
Implementation of python's caching (#266)
This commit is contained in:
parent
52636cf49a
commit
280924fbef
75 changed files with 126753 additions and 7699 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 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`);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue