@@ -38756,7 +38756,90 @@ exports.setLogLevel = setLogLevel;
38756
38756
/* 495 */,
38757
38757
/* 496 */,
38758
38758
/* 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
+ /***/ }),
38760
38843
/* 499 */
38761
38844
/***/ (function(module, __unusedexports, __webpack_require__) {
38762
38845
@@ -44017,17 +44100,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
44017
44100
exports.getCacheDistributor = exports.PackageManagers = void 0;
44018
44101
const pip_cache_1 = __importDefault(__webpack_require__(394));
44019
44102
const pipenv_cache_1 = __importDefault(__webpack_require__(235));
44103
+ const poetry_cache_1 = __importDefault(__webpack_require__(498));
44020
44104
var PackageManagers;
44021
44105
(function (PackageManagers) {
44022
44106
PackageManagers["Pip"] = "pip";
44023
44107
PackageManagers["Pipenv"] = "pipenv";
44108
+ PackageManagers["Poetry"] = "poetry";
44024
44109
})(PackageManagers = exports.PackageManagers || (exports.PackageManagers = {}));
44025
44110
function getCacheDistributor(packageManager, pythonVersion, cacheDependencyPath) {
44026
44111
switch (packageManager) {
44027
44112
case PackageManagers.Pip:
44028
44113
return new pip_cache_1.default(pythonVersion, cacheDependencyPath);
44029
44114
case PackageManagers.Pipenv:
44030
44115
return new pipenv_cache_1.default(pythonVersion, cacheDependencyPath);
44116
+ case PackageManagers.Poetry:
44117
+ return new poetry_cache_1.default(pythonVersion, cacheDependencyPath);
44031
44118
default:
44032
44119
throw new Error(`Caching for '${packageManager}' is not supported`);
44033
44120
}
0 commit comments