8000 Release · At252/setup-python@c275cf4 · GitHub
[go: up one dir, main page]

Skip to content

Commit c275cf4

Browse files
committed
Release
1 parent 7c950eb commit c275cf4

File tree

1 file changed

+88
-1
lines changed

1 file changed

+88
-1
lines changed

dist/setup/index.js

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38756,7 +38756,90 @@ exports.setLogLevel = setLogLevel;
3875638756
/* 495 */,
3875738757
/* 496 */,
3875838758
/* 497 */,
38759-
/* 498 */,
38759+
/* 498 */
38760+
/***/ (function(__unusedmodule, exports, __webpack_require__) {
38761+
38762+
"use strict";
38763+
38764+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
38765+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38766+
return new (P || (P = Promise))(function (resolve, reject) {
38767+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
38768+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
38769+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
38770+
step((generator = generator.apply(thisArg, _arguments || [])).next());
38771+
});
38772+
};
38773+
var __importStar = (this && this.__importStar) || function (mod) {
38774+
if (mod && mod.__esModule) return mod;
38775+
var result = {};
38776+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
38777+
result["default"] = mod;
38778+
return result;
38779+
};
38780+
var __importDefault = (this && this.__importDefault) || function (mod) {
38781+
return (mod && mod.__esModule) ? mod : { "default": mod };
38782+
};
38783+
Object.defineProperty(exports, "__esModule", { value: true });
38784+
const glob = __importStar(__webpack_require__(281));
38785+
const os = __importStar(__webpack_require__(87));
38786+
const path = __importStar(__webpack_require__(622));
38787+
const exec = __importStar(__webpack_require__(986));
38788+
const cache_distributor_1 = __importDefault(__webpack_require__(435));
38789+
class PoetryCache extends cache_distributor_1.default {
38790+
constructor(pythonVersion, patterns = '**/poetry.lock') {
38791+
super('poetry', patterns);
38792+
this.pythonVersion = pythonVersion;
38793+
this.patterns = patterns;
38794+
}
38795+
getCacheGlobalDirectories() {
38796+
return __awaiter(this, void 0, void 0, function* () {
38797+
const poetryConfig = yield this.getPoetryConfiguration();
38798+
const cacheDir = poetryConfig['cache-dir'];
38799+
const virtualenvsPath = poetryConfig['virtualenvs.path'].replace('{cache-dir}', cacheDir);
38800+
const paths = [virtualenvsPath];
38801+
if (poetryConfig['virtualenvs.in-project'] === 'true') {
38802+
paths.push(path.join(process.cwd(), '.venv'));
38803+
}
38804+
return paths;
38805+
});
38806+
}
38807+
computeKeys() {
38808+
return __awaiter(this, void 0, void 0, function* () {
38809+
const hash = yield glob.hashFiles(this.patterns);
38810+
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
38811+
const restoreKey = undefined;
38812+
return {
38813+
primaryKey,
38814+
restoreKey
38815+
};
38816+
});
38817+
}
38818+
getPoetryConfiguration() {
38819+
return __awaiter(this, void 0, void 0, function* () {
38820+
const { stdout, stderr, exitCode } = yield exec.getExecOutput('poetry', [
38821+
'config',
38822+
'--list'
38823+
]);
38824+
if (exitCode && stderr) {
38825+
console.log(stdout, stderr, exitCode);
38826+
throw new Error(`Could not get cache folder path for poetry package manager`);
38827+
}
38828+
const lines = stdout.trim().split(os.EOL);
38829+
const config = {};
38830+
for (let line of lines) {
38831+
line = line.replace(/#.*$/, '');
38832+
const [key, value] = line.split('=').map(part => part.trim());
38833+
config[key] = value;
38834+
}
38835+
return config;
38836+
});
38837+
}
38838+
}
38839+
exports.default = PoetryCache;
38840+
38841+
38842+
/***/ }),
3876038843
/* 499 */
3876138844
/***/ (function(module, __unusedexports, __webpack_require__) {
3876238845

@@ -44017,17 +44100,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
4401744100
exports.getCacheDistributor = exports.PackageManagers = void 0;
4401844101
const pip_cache_1 = __importDefault(__webpack_require__(394));
4401944102
const pipenv_cache_1 = __importDefault(__webpack_require__(235));
44103+
const poetry_cache_1 = __importDefault(__webpack_require__(498));
4402044104
var PackageManagers;
4402144105
(function (PackageManagers) {
4402244106
PackageManagers["Pip"] = "pip";
4402344107
PackageManagers["Pipenv"] = "pipenv";
44108+
PackageManagers["Poetry"] = "poetry";
4402444109
})(PackageManagers = exports.PackageManagers || (exports.PackageManagers = {}));
4402544110
function getCacheDistributor(packageManager, pythonVersion, cacheDependencyPath) {
4402644111
switch (packageManager) {
4402744112
case PackageManagers.Pip:
4402844113
return new pip_cache_1.default(pythonVersion, cacheDependencyPath);
4402944114
case PackageManagers.Pipenv:
4403044115
return new pipenv_cache_1.default(pythonVersion, cacheDependencyPath);
44116+
case PackageManagers.Poetry:
44117+
return new poetry_cache_1.default(pythonVersion, cacheDependencyPath);
4403144118
default:
4403244119
throw new Error(`Caching for '${packageManager}' is not supported`);
4403344120
}

0 commit comments

Comments
 (0)
0