Implementation of python's caching (#266)

This commit is contained in:
Dmitry Shibanov 2021-11-17 13:31:22 +03:00 committed by GitHub
parent 52636cf49a
commit 280924fbef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 126753 additions and 7699 deletions

View 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`);
}
}