@@ -87714,22 +87714,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
8771487714}) : function(o, v) {
8771587715    o["default"] = v;
8771687716});
87717- var __importStar = (this && this.__importStar) || function (mod) {
87718-     if (mod && mod.__esModule) return mod;
87719-     var result = {};
87720-     if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
87721-     __setModuleDefault(result, mod);
87722-     return result;
87723- };
87724- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
87725-     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
87726-     return new (P || (P = Promise))(function (resolve, reject) {
87727-         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
87728-         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
87729-         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
87730-         step((generator = generator.apply(thisArg, _arguments || [])).next());
87731-     });
87732- };
87717+ var __importStar = (this && this.__importStar) || (function () {
87718+     var ownKeys = function(o) {
87719+         ownKeys = Object.getOwnPropertyNames || function (o) {
87720+             var ar = [];
87721+             for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
87722+             return ar;
87723+         };
87724+         return ownKeys(o);
87725+     };
87726+     return function (mod) {
87727+         if (mod && mod.__esModule) return mod;
87728+         var result = {};
87729+         if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
87730+         __setModuleDefault(result, mod);
87731+         return result;
87732+     };
87733+ })();
8773387734Object.defineProperty(exports, "__esModule", ({ value: true }));
8773487735exports.State = void 0;
8773587736const cache = __importStar(__nccwpck_require__(5116));
@@ -87742,41 +87743,39 @@ var State;
8774287743    State["CACHE_PATHS"] = "cache-paths";
8774387744})(State || (exports.State = State = {}));
8774487745class CacheDistributor {
87746+     packageManager;
87747+     cacheDependencyPath;
87748+     CACHE_KEY_PREFIX = 'setup-python';
8774587749    constructor(packageManager, cacheDependencyPath) {
8774687750        this.packageManager = packageManager;
8774787751        this.cacheDependencyPath = cacheDependencyPath;
87748-         this.CACHE_KEY_PREFIX = 'setup-python';
87749-     }
87750-     handleLoadedCache() {
87751-         return __awaiter(this, void 0, void 0, function* () { });
8775287752    }
87753-     restoreCache() {
87754-         return __awaiter(this, void 0, void 0, function* () {
87755-             const { primaryKey, restoreKey } = yield this.computeKeys();
87756-             if (primaryKey.endsWith('-')) {
87757-                 const file = this.packageManager === 'pip'
87758-                     ? `${this.cacheDependencyPath
87759-                         .split('\n')
87760-                         .join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}`
87761-                     : this.cacheDependencyPath.split('\n').join(',');
87762-                 throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`);
87763-             }
87764-             const cachePath = yield this.getCacheGlobalDirectories();
87765-             core.saveState(State.CACHE_PATHS, cachePath);
87766-             let matchedKey;
87767-             try {
87768-                 matchedKey = yield cache.restoreCache(cachePath, primaryKey, restoreKey);
87769-             }
87770-             catch (err) {
87771-                 const message = err.message;
87772-                 core.info(`[warning]${message}`);
87773-                 core.setOutput('cache-hit', false);
87774-                 return;
87775-             }
87776-             core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
87777-             yield this.handleLoadedCache();
87778-             this.handleMatchResult(matchedKey, primaryKey);
87779-         });
87753+     async handleLoadedCache() { }
87754+     async restoreCache() {
87755+         const { primaryKey, restoreKey } = await this.computeKeys();
87756+         if (primaryKey.endsWith('-')) {
87757+             const file = this.packageManager === 'pip'
87758+                 ? `${this.cacheDependencyPath
87759+                     .split('\n')
87760+                     .join(',')} or ${constants_1.CACHE_DEPENDENCY_BACKUP_PATH}`
87761+                 : this.cacheDependencyPath.split('\n').join(',');
87762+             throw new Error(`No file in ${process.cwd()} matched to [${file}], make sure you have checked out the target repository`);
87763+         }
87764+         const cachePath = await this.getCacheGlobalDirectories();
87765+         core.saveState(State.CACHE_PATHS, cachePath);
87766+         let matchedKey;
87767+         try {
87768+             matchedKey = await cache.restoreCache(cachePath, primaryKey, restoreKey);
87769+         }
87770+         catch (err) {
87771+             const message = err.message;
87772+             core.info(`[warning]${message}`);
87773+             core.setOutput('cache-hit', false);
87774+             return;
87775+         }
87776+         core.saveState(State.STATE_CACHE_PRIMARY_KEY, primaryKey);
87777+         await this.handleLoadedCache();
87778+         this.handleMatchResult(matchedKey, primaryKey);
8778087779    }
8778187780    handleMatchResult(matchedKey, primaryKey) {
8778287781        if (matchedKey) {
@@ -87827,90 +87826,86 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
8782787826}) : function(o, v) {
8782887827    o["default"] = v;
8782987828});
87830- var __importStar = (this && this.__importStar) || function (mod) {
87831-     if (mod && mod.__esModule) return mod;
87832-     var result = {};
87833-     if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
87834-     __setModuleDefault(result, mod);
87835-     return result;
87836- };
87837- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
87838-     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
87839-     return new (P || (P = Promise))(function (resolve, reject) {
87840-         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
87841-         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
87842-         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
87843-         step((generator = generator.apply(thisArg, _arguments || [])).next());
87844-     });
87845- };
87829+ var __importStar = (this && this.__importStar) || (function () {
87830+     var ownKeys = function(o) {
87831+         ownKeys = Object.getOwnPropertyNames || function (o) {
87832+             var ar = [];
87833+             for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
87834+             return ar;
87835+         };
87836+         return ownKeys(o);
87837+     };
87838+     return function (mod) {
87839+         if (mod && mod.__esModule) return mod;
87840+         var result = {};
87841+         if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
87842+         __setModuleDefault(result, mod);
87843+         return result;
87844+     };
87845+ })();
8784687846var __importDefault = (this && this.__importDefault) || function (mod) {
8784787847    return (mod && mod.__esModule) ? mod : { "default": mod };
8784887848};
8784987849Object.defineProperty(exports, "__esModule", ({ value: true }));
87850- exports.run = void 0 ;
87850+ exports.run = run ;
8785187851const core = __importStar(__nccwpck_require__(7484));
8785287852const cache = __importStar(__nccwpck_require__(5116));
8785387853const fs_1 = __importDefault(__nccwpck_require__(9896));
8785487854const cache_distributor_1 = __nccwpck_require__(2326);
8785587855// Added early exit to resolve issue with slow post action step:
8785687856// - https://github.com/actions/setup-node/issues/878
8785787857// https://github.com/actions/cache/pull/1217
87858- function run(earlyExit) {
87859-     return __awaiter(this, void 0, void 0, function* () {
87860-         try {
87861-             const cache = core.getInput('cache');
87862-             if (cache) {
87863-                 yield saveCache(cache);
87864-                 if (earlyExit) {
87865-                     process.exit(0);
87866-                 }
87858+ async function run(earlyExit) {
87859+     try {
87860+         const cache = core.getInput('cache');
87861+         if (cache) {
87862+             await saveCache(cache);
87863+             if (earlyExit) {
87864+                 process.exit(0);
8786787865            }
8786887866        }
87869-         catch (error) { 
87870-             const err =  error; 
87871-             core.setFailed(err.message) ;
87872-         } 
87873-     }); 
87867+     } 
87868+     catch ( error) { 
87869+         const err = error ;
87870+         core.setFailed(err.message); 
87871+     }
8787487872}
87875- exports.run = run;
87876- function saveCache(packageManager) {
87877-     return __awaiter(this, void 0, void 0, function* () {
87878-         const cachePathState = core.getState(cache_distributor_1.State.CACHE_PATHS);
87879-         if (!cachePathState) {
87880-             core.warning('Cache paths are empty. Please check the previous logs and make sure that the python version is specified');
87881-             return;
87882-         }
87883-         const cachePaths = JSON.parse(cachePathState);
87884-         core.debug(`paths for caching are ${cachePaths.join(', ')}`);
87885-         if (!isCacheDirectoryExists(cachePaths)) {
87886-             core.warning(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed.`);
87887-             return;
87888-         }
87889-         const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY);
87890-         const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY);
87891-         if (!primaryKey) {
87892-             core.warning('Error retrieving key from state.');
87893-             return;
87894-         }
87895-         else if (matchedKey === primaryKey) {
87896-             // no change in target directories
87897-             core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
87898-             return;
87899-         }
87900-         let cacheId = 0;
87901-         try {
87902-             cacheId = yield cache.saveCache(cachePaths, primaryKey);
87903-         }
87904-         catch (err) {
87905-             const message = err.message;
87906-             core.info(`[warning]${message}`);
87907-             return;
87908-         }
87909-         if (cacheId == -1) {
87910-             return;
87911-         }
87912-         core.info(`Cache saved with the key: ${primaryKey}`);
87913-     });
87873+ async function saveCache(packageManager) {
87874+     const cachePathState = core.getState(cache_distributor_1.State.CACHE_PATHS);
87875+     if (!cachePathState) {
87876+         core.warning('Cache paths are empty. Please check the previous logs and make sure that the python version is specified');
87877+         return;
87878+     }
87879+     const cachePaths = JSON.parse(cachePathState);
87880+     core.debug(`paths for caching are ${cachePaths.join(', ')}`);
87881+     if (!isCacheDirectoryExists(cachePaths)) {
87882+         core.warning(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed.`);
87883+         return;
87884+     }
87885+     const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY);
87886+     const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY);
87887+     if (!primaryKey) {
87888+         core.warning('Error retrieving key from state.');
87889+         return;
87890+     }
87891+     else if (matchedKey === primaryKey) {
87892+         // no change in target directories
87893+         core.info(`Cache hit occurred on the primary key ${primaryKey}, not saving cache.`);
87894+         return;
87895+     }
87896+     let cacheId = 0;
87897+     try {
87898+         cacheId = await cache.saveCache(cachePaths, primaryKey);
87899+     }
87900+     catch (err) {
87901+         const message = err.message;
87902+         core.info(`[warning]${message}`);
87903+         return;
87904+     }
87905+     if (cacheId == -1) {
87906+         return;
87907+     }
87908+     core.info(`Cache saved with the key: ${primaryKey}`);
8791487909}
8791587910function isCacheDirectoryExists(cacheDirectory) {
8791687911    const result = cacheDirectory.reduce((previousValue, currentValue) => {
0 commit comments