mirror of
https://github.com/actions/setup-python.git
synced 2025-01-18 22:21:43 +07:00
Readability improvement: Move CacheDistributor constructor params to readonly abstract fields of concrete cache implementations. Remove empty CacheDistributor constructor.
This commit is contained in:
parent
3b3e184171
commit
3efe843c7b
@ -10,10 +10,8 @@ export enum State {
|
||||
|
||||
abstract class CacheDistributor {
|
||||
protected CACHE_KEY_PREFIX = 'setup-python';
|
||||
constructor(
|
||||
protected packageManager: string,
|
||||
protected cacheDependencyPath: string
|
||||
) {}
|
||||
protected abstract readonly packageManager: string;
|
||||
protected abstract readonly cacheDependencyPath: string;
|
||||
|
||||
protected abstract getCacheGlobalDirectories(): Promise<string[]>;
|
||||
protected abstract computeKeys(): Promise<{
|
||||
|
@ -12,12 +12,13 @@ import {CACHE_DEPENDENCY_BACKUP_PATH} from './constants';
|
||||
|
||||
class PipCache extends CacheDistributor {
|
||||
private cacheDependencyBackupPath: string = CACHE_DEPENDENCY_BACKUP_PATH;
|
||||
protected readonly packageManager = 'pip';
|
||||
|
||||
constructor(
|
||||
private pythonVersion: string,
|
||||
cacheDependencyPath = '**/requirements.txt'
|
||||
protected readonly cacheDependencyPath = '**/requirements.txt'
|
||||
) {
|
||||
super('pip', cacheDependencyPath);
|
||||
super();
|
||||
}
|
||||
|
||||
protected async getCacheGlobalDirectories() {
|
||||
|
@ -6,11 +6,13 @@ import * as core from '@actions/core';
|
||||
import CacheDistributor from './cache-distributor';
|
||||
|
||||
class PipenvCache extends CacheDistributor {
|
||||
protected readonly packageManager = 'pipenv';
|
||||
|
||||
constructor(
|
||||
private pythonVersion: string,
|
||||
protected cacheDependencyPath: string = '**/Pipfile.lock'
|
||||
protected readonly cacheDependencyPath: string = '**/Pipfile.lock'
|
||||
) {
|
||||
super('pipenv', cacheDependencyPath);
|
||||
super();
|
||||
}
|
||||
|
||||
protected async getCacheGlobalDirectories() {
|
||||
|
@ -8,12 +8,15 @@ import CacheDistributor from './cache-distributor';
|
||||
import {logWarning} from '../utils';
|
||||
|
||||
class PoetryCache extends CacheDistributor {
|
||||
protected readonly packageManager = 'poetry';
|
||||
|
||||
|
||||
constructor(
|
||||
private pythonVersion: string,
|
||||
protected cacheDependencyPath: string = '**/poetry.lock',
|
||||
protected readonly cacheDependencyPath: string = '**/poetry.lock',
|
||||
protected poetryProjects: Set<string> = new Set<string>()
|
||||
) {
|
||||
super('poetry', cacheDependencyPath);
|
||||
super();
|
||||
}
|
||||
|
||||
protected async getCacheGlobalDirectories() {
|
||||
|
Loading…
Reference in New Issue
Block a user