mirror of
https://github.com/actions/setup-python.git
synced 2025-01-11 18:45:17 +00:00
Readability improvement: rename PipenvCache,PoetryCache "patterns" field to "cacheDependencyPath" to be consistent with base class and cache-factory.
This commit is contained in:
parent
3fddbee787
commit
3b3e184171
@ -8,9 +8,9 @@ import CacheDistributor from './cache-distributor';
|
||||
class PipenvCache extends CacheDistributor {
|
||||
constructor(
|
||||
private pythonVersion: string,
|
||||
protected patterns: string = '**/Pipfile.lock'
|
||||
protected cacheDependencyPath: string = '**/Pipfile.lock'
|
||||
) {
|
||||
super('pipenv', patterns);
|
||||
super('pipenv', cacheDependencyPath);
|
||||
}
|
||||
|
||||
protected async getCacheGlobalDirectories() {
|
||||
@ -31,7 +31,7 @@ class PipenvCache extends CacheDistributor {
|
||||
}
|
||||
|
||||
protected async computeKeys() {
|
||||
const hash = await glob.hashFiles(this.patterns);
|
||||
const hash = await glob.hashFiles(this.cacheDependencyPath);
|
||||
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
||||
const restoreKey = undefined;
|
||||
return {
|
||||
|
@ -10,16 +10,16 @@ import {logWarning} from '../utils';
|
||||
class PoetryCache extends CacheDistributor {
|
||||
constructor(
|
||||
private pythonVersion: string,
|
||||
protected patterns: string = '**/poetry.lock',
|
||||
protected cacheDependencyPath: string = '**/poetry.lock',
|
||||
protected poetryProjects: Set<string> = new Set<string>()
|
||||
) {
|
||||
super('poetry', patterns);
|
||||
super('poetry', cacheDependencyPath);
|
||||
}
|
||||
|
||||
protected async getCacheGlobalDirectories() {
|
||||
// Same virtualenvs path may appear for different projects, hence we use a Set
|
||||
const paths = new Set<string>();
|
||||
const globber = await glob.create(this.patterns);
|
||||
const globber = await glob.create(this.cacheDependencyPath);
|
||||
|
||||
for await (const file of globber.globGenerator()) {
|
||||
const basedir = path.dirname(file);
|
||||
@ -45,7 +45,7 @@ class PoetryCache extends CacheDistributor {
|
||||
}
|
||||
|
||||
protected async computeKeys() {
|
||||
const hash = await glob.hashFiles(this.patterns);
|
||||
const hash = await glob.hashFiles(this.cacheDependencyPath);
|
||||
// "v2" is here to invalidate old caches of this cache distributor, which were created broken:
|
||||
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-python-${this.pythonVersion}-${this.packageManager}-v2-${hash}`;
|
||||
const restoreKey = undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user