From f3bb7684794a2acc17b633064fb4e6200fab3d60 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Wed, 10 Nov 2021 18:39:58 +0300 Subject: [PATCH] remove async from getCacheDistributor --- dist/setup/index.js | 29 ++++++++---------------- src/cache-distributions/cache-factory.ts | 2 +- src/setup-python.ts | 2 +- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index ea8b6e2a..f936ee50 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -6641,7 +6641,7 @@ function cacheDepencies(pythonVersion) { throw new Error('Caching is not supported on GHES'); } const cacheDependencyPath = core.getInput('cache-dependency-path') || undefined; - const cacheDistributor = yield cache_factory_1.getCacheDistributor(cache, pythonVersion, cacheDependencyPath); + const cacheDistributor = cache_factory_1.getCacheDistributor(cache, pythonVersion, cacheDependencyPath); yield cacheDistributor.restoreCache(); } }); @@ -43871,15 +43871,6 @@ module.exports = require("net"); "use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; @@ -43892,16 +43883,14 @@ var PackageManagers; PackageManagers["Pipenv"] = "pipenv"; })(PackageManagers = exports.PackageManagers || (exports.PackageManagers = {})); function getCacheDistributor(packageManager, pythonVersion, cacheDependencyPath) { - return __awaiter(this, void 0, void 0, function* () { - switch (packageManager) { - case PackageManagers.Pip: - return new pip_cache_1.default(cacheDependencyPath); - case PackageManagers.Pipenv: - return new pipenv_cache_1.default(pythonVersion, cacheDependencyPath); - default: - throw new Error(`Caching for '${packageManager}' is not supported`); - } - }); + switch (packageManager) { + case PackageManagers.Pip: + return new pip_cache_1.default(cacheDependencyPath); + case PackageManagers.Pipenv: + return new pipenv_cache_1.default(pythonVersion, cacheDependencyPath); + default: + throw new Error(`Caching for '${packageManager}' is not supported`); + } } exports.getCacheDistributor = getCacheDistributor; diff --git a/src/cache-distributions/cache-factory.ts b/src/cache-distributions/cache-factory.ts index cd6a55be..1a8a055f 100644 --- a/src/cache-distributions/cache-factory.ts +++ b/src/cache-distributions/cache-factory.ts @@ -6,7 +6,7 @@ export enum PackageManagers { Pipenv = 'pipenv' } -export async function getCacheDistributor( +export function getCacheDistributor( packageManager: string, pythonVersion: string, cacheDependencyPath: string | undefined diff --git a/src/setup-python.ts b/src/setup-python.ts index 09db37f1..2d5bd057 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -18,7 +18,7 @@ async function cacheDepencies(pythonVersion: string) { } const cacheDependencyPath = core.getInput('cache-dependency-path') || undefined; - const cacheDistributor = await getCacheDistributor( + const cacheDistributor = getCacheDistributor( cache, pythonVersion, cacheDependencyPath