Use tar for extracting the uv zip file on Windows too

Use extractTar() instead of extractZip() which is very slow for some
reason (0.3s vs 10s)

Fixes #659
This commit is contained in:
Christoph Reiter 2025-10-23 19:58:16 +02:00
parent 2ddd2b9cb3
commit 1cd7d04150
2 changed files with 2 additions and 9 deletions

6
dist/setup/index.js generated vendored
View file

@ -129171,7 +129171,6 @@ exports.tryGetFromToolCache = tryGetFromToolCache;
exports.downloadVersionFromGithub = downloadVersionFromGithub;
exports.downloadVersionFromManifest = downloadVersionFromManifest;
exports.resolveVersion = resolveVersion;
const node_fs_1 = __nccwpck_require__(73024);
const path = __importStar(__nccwpck_require__(76760));
const core = __importStar(__nccwpck_require__(37484));
const tc = __importStar(__nccwpck_require__(33472));
@ -129211,12 +129210,9 @@ async function downloadVersion(downloadUrl, artifactName, platform, arch, versio
const downloadPath = await tc.downloadTool(downloadUrl, undefined, githubToken);
await (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, version);
let uvDir;
const extension = getExtension(platform);
if (platform === "pc-windows-msvc") {
const fullPathWithExtension = `${downloadPath}${extension}`;
await node_fs_1.promises.copyFile(downloadPath, fullPathWithExtension);
uvDir = await tc.extractZip(fullPathWithExtension);
// On windows extracting the zip does not create an intermediate directory
uvDir = await tc.extractTar(downloadPath, undefined, "x");
}
else {
const extractedDir = await tc.extractTar(downloadPath);

View file

@ -108,12 +108,9 @@ async function downloadVersion(
await validateChecksum(checkSum, downloadPath, arch, platform, version);
let uvDir: string;
const extension = getExtension(platform);
if (platform === "pc-windows-msvc") {
const fullPathWithExtension = `${downloadPath}${extension}`;
await fs.copyFile(downloadPath, fullPathWithExtension);
uvDir = await tc.extractZip(fullPathWithExtension);
// On windows extracting the zip does not create an intermediate directory
uvDir = await tc.extractTar(downloadPath, undefined, "x");
} else {
const extractedDir = await tc.extractTar(downloadPath);
uvDir = path.join(extractedDir, artifactName);