chsrc/src/recipe/lang/Python/rawstr4c.md

1.6 KiB

rawstr4c input for Python

  • prefix = RAWSTR_pl_python
  • output = :global-variable-only-header
  • translate = :hex
  • no-postfix = true

uv

uv config source content

[[index]]
url = "@url@"
default = true

Get uv config

grep -A 2 'index' @f@ | sed -n 's/^url = "\(.*\)"/\1/p'

Get uv config on Windows

powershell -Command "$lines = Get-Content @f@; for($index=0; $index -lt $lines.Count; $index++) { if($lines[$index] -match '^\[\[index\]\]$') { $lines[$index..($index+3)] } }"

Set uv config

@sed@ '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = "@url@"|;}' @f@

Set uv config on Windows

powershell -Command "$content = Get-Content '@f@'; $content = $content -replace '^url = \".*\"$', 'url = \"@url@\"'; $content | Set-Content '@f@'"

Test uv if set source

grep -q '^\[\[index]]$' @f@

Test uv if set source on Windows

powershell -Command "if (Get-Content @f@ | Select-String '^\[\[index\]\]$') { exit 0 } else { exit 1 }"

Rye

  • name = rye_config
[[sources]]
name = "@1@"
url  = "@2@"