mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-01-31 22:41:27 +08:00
On windows extracting the zip does not create an intermediate directory
This commit is contained in:
parent
4203354a33
commit
3e3aecd6b6
22
dist/setup/index.js
generated
vendored
22
dist/setup/index.js
generated
vendored
@ -85413,8 +85413,8 @@ function downloadLatest(platform, arch, checkSum, githubToken) {
|
|||||||
let uvExecutablePath;
|
let uvExecutablePath;
|
||||||
let uvDir;
|
let uvDir;
|
||||||
if (platform === 'pc-windows-msvc') {
|
if (platform === 'pc-windows-msvc') {
|
||||||
const extractedDir = yield tc.extractZip(downloadPath);
|
uvDir = yield tc.extractZip(downloadPath);
|
||||||
uvDir = path.join(extractedDir, artifact);
|
// On windows extracting the zip does not create an intermediate directory
|
||||||
uvExecutablePath = path.join(uvDir, 'uv.exe');
|
uvExecutablePath = path.join(uvDir, 'uv.exe');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -85497,9 +85497,6 @@ const tc = __importStar(__nccwpck_require__(7784));
|
|||||||
const path = __importStar(__nccwpck_require__(1017));
|
const path = __importStar(__nccwpck_require__(1017));
|
||||||
const utils_1 = __nccwpck_require__(239);
|
const utils_1 = __nccwpck_require__(239);
|
||||||
const checksum_1 = __nccwpck_require__(4622);
|
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) {
|
function tryGetFromToolCache(arch, version) {
|
||||||
core.debug(`Trying to get uv from tool cache for ${version}...`);
|
core.debug(`Trying to get uv from tool cache for ${version}...`);
|
||||||
const cachedVersions = tc.findAllVersions(utils_1.TOOL_CACHE_NAME, arch);
|
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}" ...`);
|
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
||||||
const downloadPath = yield tc.downloadTool(downloadUrl, undefined, githubToken);
|
const downloadPath = yield tc.downloadTool(downloadUrl, undefined, githubToken);
|
||||||
yield (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, version);
|
yield (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, version);
|
||||||
let extractedDir;
|
let uvDir;
|
||||||
if (platform === 'pc-windows-msvc') {
|
if (platform === 'pc-windows-msvc') {
|
||||||
extractedDir = yield tc.extractZip(downloadPath);
|
uvDir = yield tc.extractZip(downloadPath);
|
||||||
const files = yield readdir(extractedDir);
|
// On windows extracting the zip does not create an intermediate directory
|
||||||
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(', ')}`);
|
|
||||||
}
|
}
|
||||||
else {
|
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;
|
exports.downloadVersion = downloadVersion;
|
||||||
|
@ -29,8 +29,8 @@ export async function downloadLatest(
|
|||||||
let uvExecutablePath: string
|
let uvExecutablePath: string
|
||||||
let uvDir: string
|
let uvDir: string
|
||||||
if (platform === 'pc-windows-msvc') {
|
if (platform === 'pc-windows-msvc') {
|
||||||
const extractedDir = await tc.extractZip(downloadPath)
|
uvDir = await tc.extractZip(downloadPath)
|
||||||
uvDir = path.join(extractedDir, artifact)
|
// On windows extracting the zip does not create an intermediate directory
|
||||||
uvExecutablePath = path.join(uvDir, 'uv.exe')
|
uvExecutablePath = path.join(uvDir, 'uv.exe')
|
||||||
} else {
|
} else {
|
||||||
const extractedDir = await tc.extractTar(downloadPath)
|
const extractedDir = await tc.extractTar(downloadPath)
|
||||||
|
@ -5,11 +5,6 @@ import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils'
|
|||||||
import {Architecture, Platform} from '../utils/platforms'
|
import {Architecture, Platform} from '../utils/platforms'
|
||||||
import {validateChecksum} from './checksum/checksum'
|
import {validateChecksum} from './checksum/checksum'
|
||||||
|
|
||||||
import * as fs from 'fs'
|
|
||||||
import * as util from 'util'
|
|
||||||
|
|
||||||
const readdir = util.promisify(fs.readdir)
|
|
||||||
|
|
||||||
export function tryGetFromToolCache(
|
export function tryGetFromToolCache(
|
||||||
arch: Architecture,
|
arch: Architecture,
|
||||||
version: string
|
version: string
|
||||||
@ -43,24 +38,14 @@ export async function downloadVersion(
|
|||||||
)
|
)
|
||||||
await validateChecksum(checkSum, downloadPath, arch, platform, version)
|
await validateChecksum(checkSum, downloadPath, arch, platform, version)
|
||||||
|
|
||||||
let extractedDir: string
|
let uvDir: string
|
||||||
if (platform === 'pc-windows-msvc') {
|
if (platform === 'pc-windows-msvc') {
|
||||||
extractedDir = await tc.extractZip(downloadPath)
|
uvDir = await tc.extractZip(downloadPath)
|
||||||
const files = await readdir(extractedDir)
|
// On windows extracting the zip does not create an intermediate directory
|
||||||
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(', ')}`)
|
|
||||||
} else {
|
} else {
|
||||||
extractedDir = await tc.extractTar(downloadPath)
|
const extractedDir = await tc.extractTar(downloadPath)
|
||||||
|
uvDir = path.join(extractedDir, artifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
return await tc.cacheDir(
|
return await tc.cacheDir(uvDir, TOOL_CACHE_NAME, version, arch)
|
||||||
path.join(extractedDir, artifact),
|
|
||||||
TOOL_CACHE_NAME,
|
|
||||||
version,
|
|
||||||
arch
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user