Skip to content

Commit

Permalink
Try installing tools locally
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeNaccarato committed Sep 16, 2024
1 parent eba9f4f commit 4c3984d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ defaults:
shell: "pwsh"
env:
UV_CACHE_DIR: ".cache/uv"
UV_SYSTEM_PYTHON: "true"
jobs:
sync:
strategy:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/high.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ defaults:
shell: "pwsh"
env:
UV_CACHE_DIR: ".cache/uv"
UV_SYSTEM_PYTHON: "true"
SYNC_PY_HIGH: "true"
jobs:
sync:
Expand Down
17 changes: 11 additions & 6 deletions scripts/Common.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,18 @@ function Sync-Uv {
if (Get-Command 'uv' -ErrorAction 'Ignore') { $Uv = 'uv' }
else {
$Uv = Get-Item 'bin/uv.???' -ErrorAction 'Ignore'
# ? Prepend local `bin` to PATH
if (!($Bin = Get-Item 'bin' -ErrorAction 'Ignore')) {
New-Item 'bin' -ItemType 'Directory'
}
$Sep = $IsWindows ? ';' : ':'
$Env:PATH = "$(Get-Item 'bin')$Sep$Env:PATH"
}
# ? Prepend local `bin` to PATH
if (!($Bin = Get-Item 'bin' -ErrorAction 'Ignore')) {
New-Item 'bin' -ItemType 'Directory'
$Bin = Get-Item 'bin'
}
$Sep = $IsWindows ? ';' : ':'
$Env:PATH = "$(Get-Item 'bin')$Sep$Env:PATH"
if ($CI) {
("PATH=$Bin$Sep$Env:PATH", "UV_TOOL_BIN_DIR=$Bin") | Add-Content $EnvFile
}
# ?
if ((!$Uv -or !(& $Uv --version | Select-String $Version))) {
'Installing uv' | Write-Progress
$OrigCargoHome = $Env:CARGO_HOME
Expand Down
4 changes: 2 additions & 2 deletions scripts/Initialize-Shell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ function Set-Env {
}
if (!(Get-Command 'context_models_tools' -ErrorAction 'Ignore')) {
'Installing tools' | Write-Progress
uv tool install --python $Version --resolution 'lowest-direct' 'scripts/.'
$Env:UV_TOOL_BIN_DIR = Get-Item 'bin'
uv tool install --force --python $Version --resolution 'lowest-direct' 'scripts/.'
'Tools installed' | Write-Progress -Done
}

Expand Down Expand Up @@ -72,7 +73,6 @@ function Set-Env {
}
}
@($Lines, $NewLines) | Set-Content $EnvFile
if ($CI) {"PATH=$(Get-Item 'bin')$Sep$Env:PATH" | Add-Content $EnvFile}
}

Set-Env
3 changes: 1 addition & 2 deletions scripts/Sync-Py.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ Param(
$High = $High ? $High : [bool]$Env:SYNC_PY_HIGH
$CI = $Env:SYNC_PY_DISABLE_CI ? $null : $Env:CI
$Devcontainer = $Env:SYNC_PY_DISABLE_DEVCONTAINER ? $null : $Env:DEVCONTAINER
$Env:UV_SYSTEM_PYTHON = $CI ? 'true' : $null
if (!$Release -and $CI) { $msg = 'CI' }
elseif ($Devcontainer) { $msg = 'devcontainer' }
elseif ($Release) {$msg = 'release'}
elseif ($Release) { $msg = 'release' }
"Will run $msg steps" | Write-Progress -Info

if ($Release) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies = [
"toml==0.10.2 ; python_version < '3.11'",
]
[project.scripts]
"context_models-tools" = "context_models_tools.__main__:main"
"context-models-tools" = "context_models_tools.__main__:main"
"context_models_tools" = "context_models_tools.__main__:main"

[tool.fawltydeps]
Expand Down

0 comments on commit 4c3984d

Please sign in to comment.