Skip to content

Commit

Permalink
🐛 Fix Windows path handling in createVenv function (#99)
Browse files Browse the repository at this point in the history
* 🐛 Fix Windows path handling in `createVenv` function

* 🐛 Fix Windows environment variable handling in `createVenv`
  • Loading branch information
yezz123 authored Nov 12, 2024
1 parent f7a3d06 commit ab6be5a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66934,7 +66934,16 @@ exports.activateVenv = activateVenv;
const exec_1 = __nccwpck_require__(1514);
const core_1 = __nccwpck_require__(2186);
const os_1 = __importDefault(__nccwpck_require__(2037));
const path_1 = __importDefault(__nccwpck_require__(1017));
const uvBinPath = path_1.default.join(os_1.default.homedir(), '.local', 'bin');
async function createVenv(venv) {
if (os_1.default.platform() === 'win32') {
await (0, exec_1.exec)('powershell', [
'-Command',
`$env:Path = "${uvBinPath};$env:Path"`
]);
}
(0, core_1.addPath)(uvBinPath);
await (0, exec_1.exec)('uv', ['venv', venv]);
}
async function activateVenv(venv) {
Expand Down
11 changes: 11 additions & 0 deletions src/venv.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
import { exec } from '@actions/exec'
import { exportVariable, addPath } from '@actions/core'
import os from 'os'
import path from 'path'

const uvBinPath = path.join(os.homedir(), '.local', 'bin')

export async function createVenv(venv: string) {
if (os.platform() === 'win32') {
await exec('powershell', [
'-Command',
`$env:Path = "${uvBinPath};$env:Path"`
])
}
addPath(uvBinPath)

await exec('uv', ['venv', venv])
}

Expand Down

0 comments on commit ab6be5a

Please sign in to comment.