@@ -66081,18 +66081,33 @@ class PoetryCache extends cache_distributor_1.default {
66081
66081
getCacheGlobalDirectories() {
66082
66082
var e_1, _a;
66083
66083
return __awaiter(this, void 0, void 0, function* () {
66084
- const paths = [];
66084
+ // Same virtualenvs path may appear for different projects, hence we use a Set
66085
+ const paths = new Set();
66085
66086
const globber = yield glob.create(this.patterns);
66087
+ const pythonLocation = yield io.which('python');
66088
+ if (pythonLocation) {
66089
+ core.debug(`pythonLocation is ${pythonLocation}`);
66090
+ }
66091
+ else {
66092
+ utils_1.logWarning('python binaries were not found in PATH');
66093
+ }
66086
66094
try {
66087
66095
for (var _b = __asyncValues(globber.globGenerator()), _c; _c = yield _b.next(), !_c.done;) {
66088
66096
const file = _c.value;
66089
66097
const basedir = path.dirname(file);
66098
+ core.debug(`Processing Poetry project at ${basedir}`);
66090
66099
const poetryConfig = yield this.getPoetryConfiguration(basedir);
66091
66100
const cacheDir = poetryConfig['cache-dir'];
66092
66101
const virtualenvsPath = poetryConfig['virtualenvs.path'].replace('{cache-dir}', cacheDir);
66093
- paths.push (virtualenvsPath);
66102
+ paths.add (virtualenvsPath);
66094
66103
if (poetryConfig['virtualenvs.in-project'] === true) {
66095
- paths.push(path.join(basedir, '.venv'));
66104
+ paths.add(path.join(basedir, '.venv'));
66105
+ }
66106
+ if (pythonLocation) {
66107
+ const { exitCode, stderr } = yield exec.getExecOutput('poetry', ['env', 'use', pythonLocation], { ignoreReturnCode: true, cwd: basedir });
66108
+ if (exitCode) {
66109
+ utils_1.logWarning(stderr);
66110
+ }
66096
66111
}
66097
66112
}
66098
66113
}
@@ -66103,18 +66118,7 @@ class PoetryCache extends cache_distributor_1.default {
66103
66118
}
66104
66119
finally { if (e_1) throw e_1.error; }
66105
66120
}
66106
- const pythonLocation = yield io.which('python');
66107
- if (pythonLocation) {
66108
- core.debug(`pythonLocation is ${pythonLocation}`);
66109
- const { exitCode, stderr } = yield exec.getExecOutput(`poetry env use ${pythonLocation}`, undefined, { ignoreReturnCode: true });
66110
- if (exitCode) {
66111
- utils_1.logWarning(stderr);
66112
- }
66113
- }
66114
- else {
66115
- utils_1.logWarning('python binaries were not found in PATH');
66116
- }
66117
- return paths;
66121
+ return Array.from(paths);
66118
66122
});
66119
66123
}
66120
66124
computeKeys() {
0 commit comments