mirror of
https://github.com/actions/setup-python.git
synced 2026-07-22 01:22:04 +02:00
f8cf4291c8
* Migrate to ESM and upgrade dependencies * Add ESM migration note to README for V7 * Remove unnecessary devDependencies: ts-node, @types/jest * npm audit fix * Upgrade @types/node to version 26.0.0 * Clarify ESM migration details in README for V7 * Update README and dependencies * Fix lint issue
27 lines
766 B
TypeScript
27 lines
766 B
TypeScript
import PipCache from './pip-cache.js';
|
|
import PipenvCache from './pipenv-cache.js';
|
|
import PoetryCache from './poetry-cache.js';
|
|
|
|
export enum PackageManagers {
|
|
Pip = 'pip',
|
|
Pipenv = 'pipenv',
|
|
Poetry = 'poetry'
|
|
}
|
|
|
|
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);
|
|
default:
|
|
throw new Error(`Caching for '${packageManager}' is not supported`);
|
|
}
|
|
}
|