mirror of
https://github.com/actions/setup-python.git
synced 2025-01-12 02:55:18 +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 {
|
class PipenvCache extends CacheDistributor {
|
||||||
constructor(
|
constructor(
|
||||||
private pythonVersion: string,
|
private pythonVersion: string,
|
||||||
protected patterns: string = '**/Pipfile.lock'
|
protected cacheDependencyPath: string = '**/Pipfile.lock'
|
||||||
) {
|
) {
|
||||||
super('pipenv', patterns);
|
super('pipenv', cacheDependencyPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async getCacheGlobalDirectories() {
|
protected async getCacheGlobalDirectories() {
|
||||||
@ -31,7 +31,7 @@ class PipenvCache extends CacheDistributor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected async computeKeys() {
|
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 primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
|
||||||
const restoreKey = undefined;
|
const restoreKey = undefined;
|
||||||
return {
|
return {
|
||||||
|
@ -10,16 +10,16 @@ import {logWarning} from '../utils';
|
|||||||
class PoetryCache extends CacheDistributor {
|
class PoetryCache extends CacheDistributor {
|
||||||
constructor(
|
constructor(
|
||||||
private pythonVersion: string,
|
private pythonVersion: string,
|
||||||
protected patterns: string = '**/poetry.lock',
|
protected cacheDependencyPath: string = '**/poetry.lock',
|
||||||
protected poetryProjects: Set<string> = new Set<string>()
|
protected poetryProjects: Set<string> = new Set<string>()
|
||||||
) {
|
) {
|
||||||
super('poetry', patterns);
|
super('poetry', cacheDependencyPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async getCacheGlobalDirectories() {
|
protected async getCacheGlobalDirectories() {
|
||||||
// Same virtualenvs path may appear for different projects, hence we use a Set
|
// Same virtualenvs path may appear for different projects, hence we use a Set
|
||||||
const paths = new Set<string>();
|
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()) {
|
for await (const file of globber.globGenerator()) {
|
||||||
const basedir = path.dirname(file);
|
const basedir = path.dirname(file);
|
||||||
@ -45,7 +45,7 @@ class PoetryCache extends CacheDistributor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected async computeKeys() {
|
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:
|
// "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 primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-python-${this.pythonVersion}-${this.packageManager}-v2-${hash}`;
|
||||||
const restoreKey = undefined;
|
const restoreKey = undefined;
|
||||||
|
Loading…
Reference in New Issue
Block a user