fix: remove extension-tools and path in favor of patha

This commit is contained in:
Amin Yahyaabadi 2022-08-20 15:38:51 -07:00
parent fd00ba5afd
commit 3b6093bb8a
34 changed files with 93 additions and 210 deletions

View File

@ -58,6 +58,7 @@ words:
- npmrc
- Opencppcoverage
- OSSDK
- patha
- pnpm
- pwsh
- pypy

2
dist/actions_python.3ea84f05.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/actions_python.3ea84f05.js.map vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/setup_cpp.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -59,11 +59,11 @@
"escape-path-with-spaces": "github:aminya/escape-path-with-spaces#d9f81ee649203ddc55783a2f96ada59df06118e3",
"exec-powershell": "workspace:1.0.0",
"execa": "^5.1.1",
"extension-tools": "workspace:1.0.0",
"is-url-online": "^1.5.0",
"mri": "^1.2.0",
"msvc-dev-cmd": "github:aminya/msvc-dev-cmd#9f672c1",
"numerous": "1.0.3",
"patha": "^0.3.0",
"root-tools": "workspace:1.0.0",
"semver": "7.3.7",
"setup-python": "github:actions/setup-python#c474c82340438924daab9282d07300bfe7e3692d",

View File

@ -1,66 +0,0 @@
<h1 align="center">extension-tools</h1>
<p>
<a href="https://www.npmjs.com/package/extension-tools" target="_blank">
<img alt="Version" src="https://img.shields.io/npm/v/extension-tools.svg">
</a>
<a href="#" target="_blank">
<img alt="License: Apache--2.0" src="https://img.shields.io/badge/License-Apache--2.0-yellow.svg" />
</a>
</p>
> Tools for working with file extensions such as getting the binary and shell extension on different platforms.
## Install
```sh
npm install --save extension-tools
```
## Usage
<!-- INSERT GENERATED DOCS START -->
### `addBinExtension` (function)
Add bin extension to the given binary name.
**Parameters:**
- name (`string`) - The name you want to add the shell extension to
- win_ext (`string`) - `.exe` on Windows
- unix_ext (`string`) - `""` On unix.
**returns:** string
### `addShellExtension` (function)
Add native shell extension to the given name
**Parameters:**
- name (`string`) - The name you want to add the shell extension to
- win_ext (`string`) - `.bat` on Windows
- unix_ext (`string`) - `.sh` On unix.
**returns:** string
### `addShellHere` (function)
Prefix a `./` for unix shell and nothing for the cmd shell
**Parameters:**
- name (`string`)
**returns:** string
<!-- INSERT GENERATED DOCS END -->
## 🤝 Contributing
You can sponsor my work here:
https://github.com/sponsors/aminya
Pull requests, issues and feature requests are welcome.
See the [Contributing guide](https://github.com/aminya/setup-cpp/blob/master/CONTRIBUTING.md).

View File

@ -1,33 +0,0 @@
{
"name": "extension-tools",
"version": "1.0.0",
"description": "Tools for working with file extensions such as getting the binary and shell extension on different platforms.",
"homepage": "https://github.com/aminya/setup-cpp",
"license": "Apache-2.0",
"author": "Amin Yahyaabadi",
"main": "./dist/index.js",
"source": "./src/index.ts",
"scripts": {
"build": "tsc"
},
"keywords": [
"extension",
"shell",
"bin",
"windows",
"sh",
"cmd",
"bat",
"exec",
"execa",
"spawn",
"system",
"unix",
"linux",
"github-actions",
"github",
"actions",
"gitlab",
"ci"
]
}

View File

@ -1,35 +0,0 @@
/**
* Add bin extension to the given binary name.
*
* @param name The name you want to add the shell extension to
* @param win_ext `.exe` on Windows
* @param unix_ext `""` On unix.
*/
export function addBinExtension(name: string, win_ext = ".exe", unix_ext = "") {
if (process.platform === "win32") {
return `${name}${win_ext}`
}
return `${name}${unix_ext}`
}
/**
* Add native shell extension to the given name
*
* @param name The name you want to add the shell extension to
* @param win_ext `.bat` on Windows
* @param unix_ext `.sh` On unix.
*/
export function addShellExtension(name: string, win_ext = ".bat", unix_ext = ".sh") {
if (process.platform === "win32") {
return `${name}${win_ext}`
}
return `${name}${unix_ext}`
}
/** Prefix a `./` for unix shell and nothing for the cmd shell */
export function addShellHere(name: string) {
if (process.platform === "win32") {
return name
}
return `./${name}`
}

View File

@ -1,7 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["./src"]
}

View File

@ -33,7 +33,6 @@ importers:
eslint-config-atomic: ^1.18.1
exec-powershell: workspace:1.0.0
execa: ^5.1.1
extension-tools: workspace:1.0.0
gen-readme: ^1.6.0
is-url-online: ^1.5.0
jest: ^28.1.3
@ -44,6 +43,7 @@ importers:
npm-run-all2: ^6.0.2
numerous: 1.0.3
parcel: 2.7.0
patha: ^0.3.0
prettier: 2.7.1
prettier-config-atomic: ^3.0.10
readme-md-generator: ^1.0.0
@ -70,11 +70,11 @@ importers:
escape-path-with-spaces: github.com/aminya/escape-path-with-spaces/d9f81ee649203ddc55783a2f96ada59df06118e3
exec-powershell: link:packages/exec-powershell
execa: 5.1.1
extension-tools: link:packages/extension-tools
is-url-online: 1.5.0
mri: 1.2.0
msvc-dev-cmd: github.com/aminya/msvc-dev-cmd/9f672c1
numerous: 1.0.3
patha: 0.3.0
root-tools: link:packages/root-tools
semver: 7.3.7
setup-python: github.com/actions/setup-python/c474c82340438924daab9282d07300bfe7e3692d
@ -130,9 +130,6 @@ importers:
devDependencies:
'@types/which': 2.0.1
packages/extension-tools:
specifiers: {}
packages/root-tools:
specifiers:
'@types/which': ^2.0.1
@ -2473,6 +2470,12 @@ packages:
resolution: {integrity: sha512-RI1L7N4JnW5gQw2spvL7Sllfuf1SaHdrZpCHiBlCXjIlufi1SMNnbu2teze3/QE67Fg2tBlH7W+mi4hVNk4p0A==}
dev: true
/@types/replace-ext/2.0.0:
resolution: {integrity: sha512-9aGCj2qmL1YHLXfqfzwP1h7fDfeB4l0gSXRndq+20lJ+kljS3/ngOpcn1RJGhZCe5C2JzWu07nElCKcJ6iAJbg==}
requiresBuild: true
dev: false
optional: true
/@types/responselike/1.0.0:
resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==}
dependencies:
@ -4189,6 +4192,11 @@ packages:
engines: {node: '>=10'}
dev: true
/escape-string-regexp/5.0.0:
resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==}
engines: {node: '>=12'}
dev: false
/eslint-config-airbnb-base/14.2.1_2iahngt3u2tkbdlu6s4gkur3pu:
resolution: {integrity: sha512-GOrQyDtVEc1Xy20U7vsB2yAoB4nBlfH5HZJeatRXHleO+OS5Ot+MWij4Dpltw4/DyIkqUfqz1epfhVR5XWWQPA==}
engines: {node: '>= 6'}
@ -7594,6 +7602,12 @@ packages:
lines-and-columns: 1.2.4
dev: true
/path-browserify/1.0.1:
resolution: {integrity: sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==}
requiresBuild: true
dev: false
optional: true
/path-exists/4.0.0:
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
engines: {node: '>=8'}
@ -7617,6 +7631,18 @@ packages:
engines: {node: '>=8'}
dev: true
/patha/0.3.0:
resolution: {integrity: sha512-8rE5/pFLwaKXE5D0SBIByEJyd36PyABurJCZNcSV+C2Rp+aiP0CwLZME2cY5XVQg91pctOxHJadzT2sZ0enIMQ==}
dependencies:
escape-string-regexp: 5.0.0
replace-ext: 2.0.0
optionalDependencies:
'@types/node': 18.7.6
'@types/replace-ext': 2.0.0
path-browserify: 1.0.1
process: 0.11.10
dev: false
/picocolors/1.0.0:
resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==}
dev: true
@ -8101,6 +8127,11 @@ packages:
engines: {node: '>=0.10'}
dev: true
/replace-ext/2.0.0:
resolution: {integrity: sha512-UszKE5KVK6JvyD92nzMn9cDapSk6w/CaFZ96CnmDMUqH9oowfxF/ZjRITD25H4DnOQClLA4/j7jLGXXLVKxAug==}
engines: {node: '>= 10'}
dev: false
/require-directory/2.1.1:
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
engines: {node: '>=0.10.0'}

View File

@ -1,5 +1,5 @@
import { execFileSync } from "child_process"
import { dirname } from "path"
import { dirname } from "patha"
import which from "which"
let binDir: string | undefined

View File

@ -1,7 +1,7 @@
/* eslint-disable require-atomic-updates */
import execa from "execa"
import { existsSync } from "fs"
import { dirname } from "path"
import { dirname } from "patha"
import which from "which"
import { addPath } from "../utils/env/addEnv"
import { InstallationInfo } from "../utils/setup/setupBin"

View File

@ -2,7 +2,7 @@ import { extractTar } from "@actions/tool-cache"
import semverLte from "semver/functions/lte"
import semverCoerce from "semver/functions/coerce"
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
import { addBinExtension } from "extension-tools"
import { addExeExt } from "patha"
import { extractZip } from "../utils/setup/extract"
/** Get the platform data for cmake */
@ -20,7 +20,7 @@ function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: s
const folderName = `cmake-${version}-${osArchStr}`
return {
binRelativeDir: "bin/",
binFileName: addBinExtension("cmake"),
binFileName: addExeExt("cmake"),
extractedFolderName: folderName,
extractFunction: extractZip,
url: `https://github.com/Kitware/CMake/releases/download/v${version}/${folderName}.zip`,
@ -32,7 +32,7 @@ function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: s
const folderName = `cmake-${version}-${osArchStr}`
return {
binRelativeDir: "CMake.app/Contents/bin/",
binFileName: addBinExtension("cmake"),
binFileName: addExeExt("cmake"),
extractedFolderName: folderName,
extractFunction: extractTar,
url: `https://github.com/Kitware/CMake/releases/download/v${version}/${folderName}.tar.gz`,
@ -49,7 +49,7 @@ function getCmakePackageInfo(version: string, platform: NodeJS.Platform, arch: s
const folderName = `cmake-${version}-${osArchStr}`
return {
binRelativeDir: "bin/",
binFileName: addBinExtension("cmake"),
binFileName: addExeExt("cmake"),
extractedFolderName: folderName,
extractFunction: extractTar,
url: `https://github.com/Kitware/CMake/releases/download/v${version}/${folderName}.tar.gz`,

View File

@ -4,13 +4,12 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { addBinExtension } from "extension-tools"
import { addExeExt, join } from "patha"
import { extractTar, extractZip } from "../utils/setup/extract"
import { notice } from "ci-log"
import { setupGraphviz } from "../graphviz/graphviz"
import { getVersion } from "../default_versions"
import { existsSync } from "fs"
import { join } from "path"
import { isArch } from "../utils/env/isArch"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
@ -24,7 +23,7 @@ function getDoxygenPackageInfo(version: string, platform: NodeJS.Platform, _arch
const folderName = `doxygen-${version}`
return {
binRelativeDir: "bin/",
binFileName: addBinExtension("doxygen"),
binFileName: addExeExt("doxygen"),
extractedFolderName: folderName,
extractFunction: extractTar,
url: `https://www.doxygen.nl/files/${folderName}.linux.bin.tar.gz`,
@ -34,7 +33,7 @@ function getDoxygenPackageInfo(version: string, platform: NodeJS.Platform, _arch
const folderName = `doxygen-${version}`
return {
binRelativeDir: "",
binFileName: addBinExtension("doxygen"),
binFileName: addExeExt("doxygen"),
extractedFolderName: folderName,
extractFunction: extractZip,
url: `https://www.doxygen.nl/files/${folderName}.windows.x64.bin.zip`,

View File

@ -1,9 +1,8 @@
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
import { setupGcc } from "../gcc"
import { getVersion } from "../../default_versions"
import path from "path"
import { join, addExeExt } from "patha"
import execa from "execa"
import { addBinExtension } from "extension-tools"
import { chmodSync } from "fs"
jest.setTimeout(3000000)
@ -27,8 +26,8 @@ describe("setup-gcc", () => {
expect(process.env.CXX?.includes("g++")).toBeTruthy()
// test compilation
const file = path.join(__dirname, "main.cpp")
const main_exe = path.join(__dirname, addBinExtension("main"))
const file = join(__dirname, "main.cpp")
const main_exe = join(__dirname, addExeExt("main"))
execa.sync("g++", [file, "-o", main_exe], { cwd: __dirname })
if (process.platform !== "win32") {
chmodSync(main_exe, "755")

View File

@ -7,10 +7,9 @@ import { setupChocoPack } from "../utils/setup/setupChocoPack"
import semverMajor from "semver/functions/major"
import semverCoerce from "semver/functions/coerce"
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
import path from "path"
import { join, addExeExt } from "patha"
import { warning, info } from "ci-log"
import ciDetect from "@npmcli/ci-detect"
import { addBinExtension } from "extension-tools"
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
import { extract7Zip } from "../utils/setup/extract"
import { isArch } from "../utils/env/isArch"
@ -54,7 +53,7 @@ function getGccPackageInfo(version: string, platform: NodeJS.Platform, arch: str
const exceptionModel: "seh" | "dwarf" = "seh" // SEH is native windows exception model https://github.com/brechtsanders/winlibs_mingw/issues/4#issuecomment-599296483
return {
binRelativeDir: "bin/",
binFileName: addBinExtension("g++"),
binFileName: addExeExt("g++"),
extractedFolderName: "mingw64",
extractFunction: extract7Zip,
url: `https://github.com/brechtsanders/winlibs_mingw/releases/download/${mingwInfo.releaseName}/winlibs-${mingwArch}-posix-${exceptionModel}-gcc-${mingwInfo.fileSuffix}.7z`,
@ -163,7 +162,7 @@ async function activateGcc(version: string, binDir: string) {
// )
if (process.platform === "win32") {
promises.push(addEnv("CC", addBinExtension(`${binDir}/gcc`)), addEnv("CXX", addBinExtension(`${binDir}/g++`)))
promises.push(addEnv("CC", addExeExt(`${binDir}/gcc`)), addEnv("CXX", addExeExt(`${binDir}/g++`)))
} else {
const majorVersion = semverMajor(semverCoerce(version) ?? version)
if (majorVersion >= 5) {
@ -197,7 +196,7 @@ async function activateGcc(version: string, binDir: string) {
}
function addGccLoggingMatcher() {
const matcherPath = path.join(__dirname, "gcc_matcher.json")
const matcherPath = join(__dirname, "gcc_matcher.json")
if (!existsSync(matcherPath)) {
return warning("the gcc_matcher.json file does not exist in the same folder as setup_cpp.js")
}

View File

@ -1,9 +1,8 @@
import execa from "execa"
import { join } from "path"
import { join, addExeExt } from "patha"
import which from "which"
import { setupCmake } from "../cmake/cmake"
import { getVersion } from "../default_versions"
import { addBinExtension } from "extension-tools"
import { extractTarByExe } from "../utils/setup/extract"
import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
@ -22,7 +21,7 @@ function getDownloadKcovPackageInfo(version: string): PackageInfo {
url: `https://github.com/SimonKagstrom/kcov/releases/download/${version}/kcov-amd64.tar.gz`,
extractedFolderName: "",
binRelativeDir: "usr/local/bin",
binFileName: addBinExtension("kcov"),
binFileName: addExeExt("kcov"),
extractFunction: extractTarByExe,
}
}
@ -32,7 +31,7 @@ function getBuildKcovPackageInfo(version: string): PackageInfo {
url: `https://github.com/SimonKagstrom/kcov/archive/refs/tags/${version}.tar.gz`,
extractedFolderName: "",
binRelativeDir: "build/src",
binFileName: addBinExtension("kcov"),
binFileName: addExeExt("kcov"),
extractFunction: buildKcov,
}
}

View File

@ -4,8 +4,7 @@ import { isUrlOnline } from "is-url-online"
import { setupTmpDir, cleanupTmpDir, testBin } from "../../utils/tests/test-helpers"
import ciDetect from "@npmcli/ci-detect"
import execa from "execa"
import path from "path"
import { addBinExtension } from "extension-tools"
import path, { addExeExt } from "patha"
import { chmodSync } from "fs"
import { getVersion } from "../../default_versions"
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
@ -88,7 +87,7 @@ describe("setup-llvm", () => {
// test compilation
const file = path.join(__dirname, "main.cpp")
const main_exe = path.join(__dirname, addBinExtension("main"))
const main_exe = path.join(__dirname, addExeExt("main"))
execa.sync("clang++", [file, "-o", main_exe], { cwd: __dirname })
if (process.platform !== "win32") {
chmodSync(main_exe, "755")

View File

@ -1,4 +1,4 @@
import * as path from "path"
import { join, delimiter, addExeExt } from "patha"
import semverLte from "semver/functions/lte"
import semverMajor from "semver/functions/major"
import { isUrlOnline } from "is-url-online"
@ -11,7 +11,6 @@ import {
semverCoerceIfInvalid,
} from "../utils/setup/version"
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
import { addBinExtension } from "extension-tools"
import { addEnv } from "../utils/env/addEnv"
import { setOutput } from "@actions/core"
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
@ -267,7 +266,7 @@ async function getLLVMPackageInfo(version: string, platform: NodeJS.Platform, _a
url,
extractedFolderName: "",
binRelativeDir: "bin",
binFileName: addBinExtension("clang"),
binFileName: addExeExt("clang"),
extractFunction:
platform === "win32"
? extractExe
@ -306,7 +305,7 @@ async function _setupLLVM(version: string, setupDir: string, arch: string) {
export async function activateLLVM(directory: string, versionGiven: string) {
const version = semverCoerceIfInvalid(versionGiven)
const lib = path.join(directory, "lib")
const lib = join(directory, "lib")
const ld = process.env.LD_LIBRARY_PATH ?? ""
const dyld = process.env.DYLD_LIBRARY_PATH ?? ""
@ -316,16 +315,16 @@ export async function activateLLVM(directory: string, versionGiven: string) {
addEnv("LLVM_PATH", directory),
// Setup LLVM as the compiler
addEnv("LD_LIBRARY_PATH", `${lib}${path.delimiter}${ld}`),
addEnv("DYLD_LIBRARY_PATH", `${lib}${path.delimiter}${dyld}`),
addEnv("LD_LIBRARY_PATH", `${lib}${delimiter}${ld}`),
addEnv("DYLD_LIBRARY_PATH", `${lib}${delimiter}${dyld}`),
// compiler flags
addEnv("LDFLAGS", `-L"${directory}/lib"`),
addEnv("CPPFLAGS", `-I"${directory}/include"`),
// compiler paths
addEnv("CC", addBinExtension(`${directory}/bin/clang`)),
addEnv("CXX", addBinExtension(`${directory}/bin/clang++`)),
addEnv("CC", addExeExt(`${directory}/bin/clang`)),
addEnv("CXX", addExeExt(`${directory}/bin/clang++`)),
addEnv("LIBRARY_PATH", `${directory}/lib`),
@ -369,7 +368,7 @@ export function setupClangTools(version: string, setupDir: string, arch: string)
}
function addLLVMLoggingMatcher() {
const matcherPath = path.join(__dirname, "llvm_matcher.json")
const matcherPath = join(__dirname, "llvm_matcher.json")
if (!existsSync(matcherPath)) {
return warning("the llvm_matcher.json file does not exist in the same folder as setup_cpp.js")
}

View File

@ -36,7 +36,7 @@ import { setupGcc } from "./gcc/gcc"
import { InstallationInfo } from "./utils/setup/setupBin"
import { error, info, success, warning } from "ci-log"
import { setupVcpkg } from "./vcpkg/vcpkg"
import { join } from "path"
import { join } from "patha"
import { setupVCVarsall } from "./vcvarsall/vcvarsall"
import { setupKcov } from "./kcov/kcov"
import { addEnv } from "./utils/env/addEnv"

View File

@ -4,7 +4,7 @@ import { setupVCVarsall } from "../vcvarsall/vcvarsall"
// @ts-ignore
import { vsversion_to_versionnumber, findVcvarsall } from "msvc-dev-cmd/lib.js"
import ciDetect from "@npmcli/ci-detect"
import path from "path"
import { join } from "patha"
import { existsSync } from "fs"
import { error, info, warning } from "ci-log"
@ -71,7 +71,7 @@ export async function setupMSVC(
}
function addMSVCLoggingMatcher() {
const matcherPath = path.join(__dirname, "msvc_matcher.json")
const matcherPath = join(__dirname, "msvc_matcher.json")
if (!existsSync(matcherPath)) {
return warning("the msvc_matcher.json file does not exist in the same folder as setup_cpp.js")
}

View File

@ -1,4 +1,4 @@
import { dirname } from "path"
import { dirname } from "patha"
import which from "which"
import { isUbuntu } from "../utils/env/isUbuntu"
import { execRootSync } from "root-tools"

View File

@ -1,4 +1,4 @@
import { addBinExtension } from "extension-tools"
import { addExeExt } from "patha"
import { extractZip } from "../utils/setup/extract"
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
@ -22,7 +22,7 @@ function getNinjaPackageInfo(version: string, platform: NodeJS.Platform, _arch:
const ninjaPlatform = getNinjaPlatform(platform)
return {
binRelativeDir: "",
binFileName: addBinExtension("ninja"),
binFileName: addExeExt("ninja"),
extractedFolderName: "",
extractFunction: extractZip,
url: `https://github.com/ninja-build/ninja/releases/download/v${version}/ninja-${ninjaPlatform}.zip`,

View File

@ -3,7 +3,7 @@ import { findPyPyVersion } from "setup-python/src/find-pypy"
import { existsSync } from "fs"
import { info, warning } from "ci-log"
import { debug } from "@actions/core"
import path from "path"
import { join } from "patha"
import ciDetect from "@npmcli/ci-detect"
import { isCacheFeatureAvailable, IS_LINUX, IS_WINDOWS } from "setup-python/src/utils"
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
@ -80,7 +80,7 @@ export async function setupActionsPython(version: string, _setupDir: string, arc
}
function addPythonLoggingMatcher() {
const matcherPath = path.join(__dirname, "python_matcher.json")
const matcherPath = join(__dirname, "python_matcher.json")
if (!existsSync(matcherPath)) {
return warning("the python_matcher.json file does not exist in the same folder as setup_cpp.js")
}

View File

@ -8,7 +8,7 @@ import { warning, info } from "ci-log"
import { isArch } from "../utils/env/isArch"
import which from "which"
import { InstallationInfo } from "../utils/setup/setupBin"
import { dirname, join } from "path"
import { dirname, join } from "patha"
import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"

View File

@ -1,4 +1,4 @@
import { addBinExtension } from "extension-tools"
import { addExeExt } from "patha"
import { extractTarByExe, extractZip } from "../utils/setup/extract"
import { setupBin, PackageInfo, InstallationInfo } from "../utils/setup/setupBin"
@ -35,7 +35,7 @@ function getTaskPackageInfo(version: string, platform: NodeJS.Platform, arch: st
const extension = isZip ? "zip" : "tar.gz"
return {
binRelativeDir: "",
binFileName: addBinExtension("task"),
binFileName: addExeExt("task"),
extractedFolderName: "",
extractFunction: isZip ? extractZip : extractTarByExe,
url: `https://github.com/go-task/task/releases/download/v${version}/task_${taskPlatform}_${taskArch}.${extension}`,

View File

@ -4,7 +4,7 @@ import { untildifyUser } from "untildify-user"
import { appendFileSync, existsSync, readFileSync } from "fs"
import { error, warning } from "ci-log"
import { execPowershell } from "exec-powershell"
import { delimiter } from "path"
import { delimiter } from "patha"
import escapeSpace from "escape-path-with-spaces"
/**
@ -85,7 +85,7 @@ async function addPathSystem(path: string) {
case "win32": {
// We do not use `execa.sync(`setx PATH "${path};%PATH%"`)` because of its character limit and also because %PATH% is different for user and system
await execPowershell(
`$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${path};$USER_PATH", "User")`
`$USER_PATH=([Environment]::GetEnvironmentVariable("patha", "User")); [Environment]::SetEnvironmentVariable("patha", "${path};$USER_PATH", "User")`
)
info(`"${path}" was added to the PATH.`)
return

View File

@ -1,7 +1,7 @@
import { find, downloadTool, cacheDir } from "@actions/tool-cache"
import { info } from "@actions/core"
import { addPath } from "../env/addEnv"
import { join } from "path"
import { join } from "patha"
import { existsSync } from "fs"
import { tmpdir } from "os"
import ciDetect from "@npmcli/ci-detect"

View File

@ -6,7 +6,7 @@ import { info } from "@actions/core"
import { addPath } from "../env/addEnv"
import { setupPython } from "../../python/python"
import { isBinUptoDate } from "./version"
import { join } from "path"
import { join } from "patha"
import { getVersion } from "../../default_versions"
import { InstallationInfo } from "./setupBin"
import { setupAptPack } from "./setupAptPack"

View File

@ -1,8 +1,7 @@
import * as io from "@actions/io"
import { tmpdir } from "os"
import * as path from "path"
import { addBinExtension } from "extension-tools"
import { join } from "path"
import * as path from "patha"
import { addExeExt, join } from "patha"
import spawn from "cross-spawn"
import { existsSync } from "fs"
@ -41,7 +40,7 @@ export async function testBin(
expect(binDir).toBeDefined()
expect(binDir).not.toHaveLength(0)
expect(existsSync(binDir)).toBeTruthy()
bin = join(binDir, addBinExtension(name))
bin = join(binDir, addExeExt(name))
}
if (args !== null) {

View File

@ -1,9 +1,8 @@
import execa from "execa"
import { existsSync } from "fs"
import { dirname, join } from "path"
import { dirname, join, addShExt, addShRelativePrefix } from "patha"
import which from "which"
import { addPath } from "../utils/env/addEnv"
import { addShellExtension, addShellHere } from "extension-tools"
import { notice } from "ci-log"
import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
@ -45,13 +44,13 @@ export async function setupVcpkg(_version: string, setupDir: string, _arch: stri
}
}
if (!existsSync(join(setupDir, addShellExtension("bootstrap-vcpkg")))) {
if (!existsSync(join(setupDir, addShExt("bootstrap-vcpkg")))) {
execa.sync("git", ["clone", "https://github.com/microsoft/vcpkg"], { cwd: dirname(setupDir), stdio: "inherit" })
} else {
notice(`Vcpkg folder already exists at ${setupDir}. This might mean that ~/vcpkg is restored from the cache.`)
}
execa.sync(addShellExtension(addShellHere("bootstrap-vcpkg")), { cwd: setupDir, shell: true, stdio: "inherit" })
execa.sync(addShExt(addShRelativePrefix("bootstrap-vcpkg")), { cwd: setupDir, shell: true, stdio: "inherit" })
giveUserAccess(setupDir)