-
Notifications
You must be signed in to change notification settings - Fork 711
Expand file tree
/
Copy pathcache-factory.ts
More file actions
30 lines (28 loc) · 895 Bytes
/
cache-factory.ts
File metadata and controls
30 lines (28 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import PipCache from './pip-cache';
import PipenvCache from './pipenv-cache';
import PoetryCache from './poetry-cache';
import UvCache from './uv-cache';
export enum PackageManagers {
Pip = 'pip',
Pipenv = 'pipenv',
Poetry = 'poetry',
Uv = 'uv'
}
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);
case PackageManagers.Poetry:
return new PoetryCache(pythonVersion, cacheDependencyPath);
case PackageManagers.Uv:
return new UvCache(pythonVersion, cacheDependencyPath);
default:
throw new Error(`Caching for '${packageManager}' is not supported`);
}
}