File size: 8,645 Bytes
cd53438
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<#
.SYNOPSIS
  Bootstrap the SimReady Pipeline Bot runtime dependencies.

.DESCRIPTION
  Idempotent. Run once on a fresh machine, or re-run any time to fix a
  missing dependency. Creates a Python venv, clones the foundation + SDK
  repos, and pip-installs everything the /simready-report skill needs.

  The foundation specs are *not* editable-installed any more. validate.py
  now defaults to populating the OAV registries via the simready-validate
  CLI loader against on-disk paths under the foundations checkout.
  Avoids the `repo usd_profiles_codegen` codegen step (which depends on
  internal packman tooling not shipped in the public GitHub repo) and the
  Forced-include trap in nv_core/sr_specs/pyproject.toml.

  Layout produced (all under -DepsRoot, default $env:LOCALAPPDATA\simready):

    <DepsRoot>\
      β”œβ”€β”€ venv\                     # Python venv (created if missing)
      β”œβ”€β”€ simready_foundations\     # cloned from NVIDIA GitHub
      └── simready-oem-sdk-poc\     # cloned from NVIDIA-dev GitHub

  After a successful install the script writes three User-level environment
  variables so the /simready-report skill can locate everything from any shell:

    SIMREADY_PYTHON           = <DepsRoot>\venv\Scripts\python.exe
    SIMREADY_FOUNDATIONS_PATH = <DepsRoot>\simready_foundations
    SIMREADY_SDK_PATH         = <DepsRoot>\simready-oem-sdk-poc

  Override the location with -DepsRoot, e.g.:
    .\bootstrap.ps1 -DepsRoot D:\simready-deps

  Already have these repos checked out elsewhere? Skip this script and
  set the two env vars manually.

  Optional (not bootstrapped): a `usd_validation_dashboard_final\` clone β€”
  used only to copy Sphinx _static\ assets into rendered doc pages. If
  absent, the dashboard's doc pages fall back to minimal inline styling.

.NOTES
  - Reversible: the dirs created here are safe to delete; rerun this
    script to re-create them. The two env vars can be cleared with
    `[Environment]::SetEnvironmentVariable("SIMREADY_FOUNDATIONS_PATH", $null, "User")`.
  - Requires: git, python (3.11+ recommended), and access to
    github.com/NVIDIA + github.com/NVIDIA-dev (creds via the user's
    existing git/gh auth).
  - Never elevates / never modifies system PATH.
#>
[CmdletBinding()]
param(
  [switch]$Force,                                  # re-clone even if dirs exist
  [string]$Python = "python",                      # python interpreter to seed the venv
  [string]$DepsRoot = (Join-Path $env:LOCALAPPDATA "simready"),
  [string]$FoundationsRepo = "https://github.com/NVIDIA/simready-foundation.git",
  [string]$SdkRepo         = "https://github.com/NVIDIA-dev/simready-oem-sdk-poc.git"
)

$ErrorActionPreference = "Stop"

if (-not (Test-Path $DepsRoot)) {
  New-Item -ItemType Directory -Path $DepsRoot -Force | Out-Null
}
$DepsRoot = (Resolve-Path $DepsRoot).Path

$VenvPath        = Join-Path $DepsRoot "venv"
$FoundationsPath = Join-Path $DepsRoot "simready_foundations"
$SdkPath         = Join-Path $DepsRoot "simready-oem-sdk-poc"

function Step($msg) { Write-Host ""; Write-Host "==> $msg" -ForegroundColor Cyan }
function Note($msg) { Write-Host "    $msg" -ForegroundColor DarkGray }
function Done($msg) { Write-Host "    OK: $msg" -ForegroundColor Green }
function Fail($msg) { Write-Host "    FAIL: $msg" -ForegroundColor Red; exit 1 }

Write-Host "DepsRoot: $DepsRoot" -ForegroundColor Yellow

# ---- Pre-flight ----------------------------------------------------------

Step "Pre-flight"
foreach ($cmd in @("git", $Python)) {
  $found = Get-Command $cmd -ErrorAction SilentlyContinue
  if (-not $found) { Fail "$cmd not on PATH" }
  Note "$cmd  -> $($found.Source)"
}

# ---- Clone the repos -----------------------------------------------------

function Ensure-Repo($name, $url, $path) {
  if ((Test-Path $path) -and -not $Force) {
    if (Test-Path (Join-Path $path ".git")) {
      $existingUrl = $null
      Push-Location $path
      try { $existingUrl = (git remote get-url origin 2>$null) } finally { Pop-Location }
      if ($existingUrl -and ($existingUrl.Trim() -ne $url.Trim())) {
        Fail "$name at $path has origin '$($existingUrl.Trim())' but expected '$url'. Re-run with -Force to re-clone, or fix manually: git -C `"$path`" remote set-url origin `"$url`""
      }
      Note "$name already cloned at $path  (use -Force to re-clone)"
      return
    } else {
      Fail "$path exists but is not a git checkout. Move or delete it first."
    }
  }
  if ((Test-Path $path) -and $Force) {
    Note "Removing $path (-Force)"
    Remove-Item -Recurse -Force $path
  }
  Note "git clone $url $path"
  git clone $url $path
  if ($LASTEXITCODE -ne 0) { Fail "git clone $name failed" }
  Done "$name cloned"
}

Step "simready_foundations"
Ensure-Repo "simready_foundations" $FoundationsRepo $FoundationsPath

Step "simready-oem-sdk-poc"
Ensure-Repo "simready-oem-sdk-poc" $SdkRepo $SdkPath

# ---- Python venv ---------------------------------------------------------

Step "Python venv at $VenvPath"
if (-not (Test-Path (Join-Path $VenvPath "Scripts\python.exe"))) {
  & $Python -m venv $VenvPath
  if ($LASTEXITCODE -ne 0) { Fail "venv creation failed" }
  Done "venv created"
} else {
  Note "venv already present"
}
$VenvPython = Join-Path $VenvPath "Scripts\python.exe"
$VenvPip    = Join-Path $VenvPath "Scripts\pip.exe"

# ---- Pip installs --------------------------------------------------------

Step "Upgrade pip / install runtime deps"
& $VenvPython -m pip install --upgrade pip wheel setuptools | Out-Null
if ($LASTEXITCODE -ne 0) { Fail "pip self-upgrade failed" }

$Pkgs = @(
  "usd-core==26.5",
  "omniverse-asset-validator==1.15.1",
  "omniverse-usd-profiles==1.11.0",
  "markdown-it-py>=3.0",
  "click>=8.0",
  "simready-validate>=2026.4.8"
)
& $VenvPip install @Pkgs
if ($LASTEXITCODE -ne 0) { Fail "pip install (runtime deps) failed" }
Done "runtime deps installed (incl. simready-validate from PyPI β€” provides the CLI loader)"

# Editable install of nv_core/sr_specs is no longer required. validate.py
# now defaults to populating the OAV registries via
# simready.validate.impl.loader.load_validation_implementation against
# on-disk paths under the foundations checkout. The legacy editable
# install + repo usd_profiles_codegen flow is reachable via the
# --use-plugin opt-in flag if needed.

Step "Editable install of simready-oem-sdk-poc (for auto-package step)"
& $VenvPip install -e $SdkPath
if ($LASTEXITCODE -ne 0) { Fail "pip install -e simready-oem-sdk-poc failed" }
Done "SDK editable install complete"

# ---- Smoke check ---------------------------------------------------------

Step "Smoke check"
& $VenvPython -c @"
import omni.asset_validator as oav
from pxr import Usd
from markdown_it import MarkdownIt
import simready_sdk
from simready.validate.impl.loader import load_validation_implementation
from pathlib import Path
import os
foundations = Path(os.environ.get('SIMREADY_FOUNDATIONS_PATH') or r'$FoundationsPath')
load_validation_implementation(
    rules_and_requirements_paths=[foundations / 'nv_core/sr_specs/docs/capabilities'],
    features_paths=[foundations / 'nv_core/sr_specs/docs/features'],
    profiles_paths=[foundations / 'nv_core/sr_specs/docs/profiles/profiles.toml'],
)
pr = oav.ProfileRegistry()
profiles = list(pr.values())
print(f'  asset-validator: {oav.__version__ if hasattr(oav,"__version__") else "(no version attr)"}')
print(f'  profiles loaded: {len(profiles)}')
print(f'  simready_sdk:    {simready_sdk.__file__}')
"@
if ($LASTEXITCODE -ne 0) { Fail "smoke check failed" }
Done "imports + CLI-loader populated ProfileRegistry working"

# ---- Persist env vars so validate.py finds the deps without args -------

Step "Persist locator env vars (User scope)"
[Environment]::SetEnvironmentVariable("SIMREADY_PYTHON",           $VenvPython,      "User")
[Environment]::SetEnvironmentVariable("SIMREADY_FOUNDATIONS_PATH", $FoundationsPath, "User")
[Environment]::SetEnvironmentVariable("SIMREADY_SDK_PATH",         $SdkPath,         "User")
$env:SIMREADY_PYTHON           = $VenvPython
$env:SIMREADY_FOUNDATIONS_PATH = $FoundationsPath
$env:SIMREADY_SDK_PATH         = $SdkPath
Note "SIMREADY_PYTHON           = $VenvPython"
Note "SIMREADY_FOUNDATIONS_PATH = $FoundationsPath"
Note "SIMREADY_SDK_PATH         = $SdkPath"
Done "env vars set for current user"

# ---- Done ---------------------------------------------------------------

Write-Host ""
Write-Host "Bootstrap complete." -ForegroundColor Green
Write-Host "DepsRoot: $DepsRoot" -ForegroundColor Green
Write-Host "Next: invoke /simready-report against any asset directory." -ForegroundColor Green