diff --git a/dist/setup/index.js b/dist/setup/index.js index 51b882c..3c46b40 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -85413,8 +85413,8 @@ function downloadLatest(platform, arch, checkSum, githubToken) { let uvExecutablePath; let uvDir; if (platform === 'pc-windows-msvc') { - const extractedDir = yield tc.extractZip(downloadPath); - uvDir = path.join(extractedDir, artifact); + uvDir = yield tc.extractZip(downloadPath); + // On windows extracting the zip does not create an intermediate directory uvExecutablePath = path.join(uvDir, 'uv.exe'); } else { @@ -85497,9 +85497,6 @@ const tc = __importStar(__nccwpck_require__(7784)); const path = __importStar(__nccwpck_require__(1017)); const utils_1 = __nccwpck_require__(239); const checksum_1 = __nccwpck_require__(4622); -const fs = __importStar(__nccwpck_require__(7147)); -const util = __importStar(__nccwpck_require__(3837)); -const readdir = util.promisify(fs.readdir); function tryGetFromToolCache(arch, version) { core.debug(`Trying to get uv from tool cache for ${version}...`); const cachedVersions = tc.findAllVersions(utils_1.TOOL_CACHE_NAME, arch); @@ -85520,19 +85517,16 @@ function downloadVersion(platform, arch, version, checkSum, githubToken) { core.info(`Downloading uv from "${downloadUrl}" ...`); const downloadPath = yield tc.downloadTool(downloadUrl, undefined, githubToken); yield (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, version); - let extractedDir; + let uvDir; if (platform === 'pc-windows-msvc') { - extractedDir = yield tc.extractZip(downloadPath); - const files = yield readdir(extractedDir); - core.info(`Contents of extracted directory ${extractedDir}: ${files.join(', ')}`); - const uvDir = path.join(extractedDir, artifact); - const uvfiles = yield readdir(uvDir); - core.info(`Contents of directory ${uvDir}: ${uvfiles.join(', ')}`); + uvDir = yield tc.extractZip(downloadPath); + // On windows extracting the zip does not create an intermediate directory } else { - extractedDir = yield tc.extractTar(downloadPath); + const extractedDir = yield tc.extractTar(downloadPath); + uvDir = path.join(extractedDir, artifact); } - return yield tc.cacheDir(path.join(extractedDir, artifact), utils_1.TOOL_CACHE_NAME, version, arch); + return yield tc.cacheDir(uvDir, utils_1.TOOL_CACHE_NAME, version, arch); }); } exports.downloadVersion = downloadVersion; diff --git a/src/download/download-latest.ts b/src/download/download-latest.ts index b7c4a97..3dcad7a 100644 --- a/src/download/download-latest.ts +++ b/src/download/download-latest.ts @@ -29,8 +29,8 @@ export async function downloadLatest( let uvExecutablePath: string let uvDir: string if (platform === 'pc-windows-msvc') { - const extractedDir = await tc.extractZip(downloadPath) - uvDir = path.join(extractedDir, artifact) + uvDir = await tc.extractZip(downloadPath) + // On windows extracting the zip does not create an intermediate directory uvExecutablePath = path.join(uvDir, 'uv.exe') } else { const extractedDir = await tc.extractTar(downloadPath) diff --git a/src/download/download-version.ts b/src/download/download-version.ts index 645d329..33eb09c 100644 --- a/src/download/download-version.ts +++ b/src/download/download-version.ts @@ -5,11 +5,6 @@ import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils' import {Architecture, Platform} from '../utils/platforms' import {validateChecksum} from './checksum/checksum' -import * as fs from 'fs' -import * as util from 'util' - -const readdir = util.promisify(fs.readdir) - export function tryGetFromToolCache( arch: Architecture, version: string @@ -43,24 +38,14 @@ export async function downloadVersion( ) await validateChecksum(checkSum, downloadPath, arch, platform, version) - let extractedDir: string + let uvDir: string if (platform === 'pc-windows-msvc') { - extractedDir = await tc.extractZip(downloadPath) - const files = await readdir(extractedDir) - core.info( - `Contents of extracted directory ${extractedDir}: ${files.join(', ')}` - ) - const uvDir = path.join(extractedDir, artifact) - const uvfiles = await readdir(uvDir) - core.info(`Contents of directory ${uvDir}: ${uvfiles.join(', ')}`) + uvDir = await tc.extractZip(downloadPath) + // On windows extracting the zip does not create an intermediate directory } else { - extractedDir = await tc.extractTar(downloadPath) + const extractedDir = await tc.extractTar(downloadPath) + uvDir = path.join(extractedDir, artifact) } - return await tc.cacheDir( - path.join(extractedDir, artifact), - TOOL_CACHE_NAME, - version, - arch - ) + return await tc.cacheDir(uvDir, TOOL_CACHE_NAME, version, arch) }