mirror of
https://github.com/actions/setup-python.git
synced 2025-04-20 03:53:30 +00:00
poetry: Support same virtualenv appearing in multiple projects
This commit is contained in:
parent
157f5da699
commit
dc45b1e4e0
9
dist/setup/index.js
vendored
9
dist/setup/index.js
vendored
@ -66105,7 +66105,8 @@ class PoetryCache extends cache_distributor_1.default {
|
|||||||
getCacheGlobalDirectories() {
|
getCacheGlobalDirectories() {
|
||||||
var e_1, _a;
|
var e_1, _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const paths = [];
|
// Same virtualenvs path may appear for different projects, hence we use a Set
|
||||||
|
const paths = new Set();
|
||||||
const globber = yield glob.create(this.patterns);
|
const globber = yield glob.create(this.patterns);
|
||||||
try {
|
try {
|
||||||
for (var _b = __asyncValues(globber.globGenerator()), _c; _c = yield _b.next(), !_c.done;) {
|
for (var _b = __asyncValues(globber.globGenerator()), _c; _c = yield _b.next(), !_c.done;) {
|
||||||
@ -66114,9 +66115,9 @@ class PoetryCache extends cache_distributor_1.default {
|
|||||||
const poetryConfig = yield this.getPoetryConfiguration(basedir);
|
const poetryConfig = yield this.getPoetryConfiguration(basedir);
|
||||||
const cacheDir = poetryConfig['cache-dir'];
|
const cacheDir = poetryConfig['cache-dir'];
|
||||||
const virtualenvsPath = poetryConfig['virtualenvs.path'].replace('{cache-dir}', cacheDir);
|
const virtualenvsPath = poetryConfig['virtualenvs.path'].replace('{cache-dir}', cacheDir);
|
||||||
paths.push(virtualenvsPath);
|
paths.add(virtualenvsPath);
|
||||||
if (poetryConfig['virtualenvs.in-project'] === true) {
|
if (poetryConfig['virtualenvs.in-project'] === true) {
|
||||||
paths.push(path.join(basedir, '.venv'));
|
paths.add(path.join(basedir, '.venv'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66138,7 +66139,7 @@ class PoetryCache extends cache_distributor_1.default {
|
|||||||
else {
|
else {
|
||||||
utils_1.logWarning('python binaries were not found in PATH');
|
utils_1.logWarning('python binaries were not found in PATH');
|
||||||
}
|
}
|
||||||
return paths;
|
return [...paths];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
computeKeys() {
|
computeKeys() {
|
||||||
|
@ -16,7 +16,8 @@ class PoetryCache extends CacheDistributor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected async getCacheGlobalDirectories() {
|
protected async getCacheGlobalDirectories() {
|
||||||
const paths = [];
|
// 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.patterns);
|
||||||
|
|
||||||
for await (const file of globber.globGenerator()) {
|
for await (const file of globber.globGenerator()) {
|
||||||
@ -29,10 +30,10 @@ class PoetryCache extends CacheDistributor {
|
|||||||
cacheDir
|
cacheDir
|
||||||
);
|
);
|
||||||
|
|
||||||
paths.push(virtualenvsPath);
|
paths.add(virtualenvsPath);
|
||||||
|
|
||||||
if (poetryConfig['virtualenvs.in-project'] === true) {
|
if (poetryConfig['virtualenvs.in-project'] === true) {
|
||||||
paths.push(path.join(basedir, '.venv'));
|
paths.add(path.join(basedir, '.venv'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ class PoetryCache extends CacheDistributor {
|
|||||||
logWarning('python binaries were not found in PATH');
|
logWarning('python binaries were not found in PATH');
|
||||||
}
|
}
|
||||||
|
|
||||||
return paths;
|
return [...paths];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async computeKeys() {
|
protected async computeKeys() {
|
||||||
|
Loading…
Reference in New Issue
Block a user