psadt
napt.psadt
PSAppDeployToolkit integration for NAPT.
Handles PSAppDeployToolkit (PSADT) release management, caching, and integration with NAPT's build system.
Modules:
| Name | Description |
|---|---|
release |
PSADT release download, caching, and version resolution. |
napt.psadt.release
PSADT release management for NAPT.
This module fetches, verifies, and caches PSAppDeployToolkit releases from the official GitHub repository through napt.github.
Key Features:
- Resolve "latest" to the current release, or find a pinned version's release however the repository tags it
- Download the Template_v4 archive and check it against what the release publishes for it
- Extract into the cache only once the archive holds what NAPT builds from
Note
- Caches releases by version: cache/psadt/{version}/
- Checks the download against the digest (or size) the release publishes for the asset
- Extracts in a working folder beside the entry, and moves the result into place only once verified, so an interrupted run leaves no entry behind; a working folder a killed run left behind is removed once it is a day old
- A cache entry counts only when it holds every Template_v4 entry NAPT builds from, the same check the download passes
GITHUB_TOKENin the environment is sent on the API calls, which otherwise count against the unauthenticated limit of 60 per hour
missing_template_entries
Lists the Template_v4 entries NAPT needs that a folder lacks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
An extracted archive, a cache entry, or a build directory. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
The missing entries, in the order NAPT lists them; empty when the |
list[str]
|
layout is the one NAPT builds from. |
Source code in napt/psadt/release.py
is_psadt_cached
Reports whether a PSADT version is cached and complete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
str
|
PSADT version to check (e.g., "4.1.7"). |
required |
cache_dir
|
Path
|
Base cache directory (e.g., Path("cache/psadt")). |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the cache entry holds every Template_v4 entry NAPT builds |
bool
|
from, False otherwise. |
Example
Check if PSADT version is cached:
Source code in napt/psadt/release.py
get_psadt_release
Returns the cache entry for a PSADT release, downloading it if needed.
Resolves "latest" to the current release, or finds a pinned version's release under either tag spelling, then downloads the Template_v4 archive, verifies it, and extracts it into the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
release_spec
|
str
|
Version specifier - either "latest" or specific version (e.g., "4.1.7" or "v4.1.7"). |
required |
cache_dir
|
Path
|
Base cache directory for PSADT releases. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Path to the cached PSADT directory (cache_dir/{version}). |
Raises:
| Type | Description |
|---|---|
NetworkError
|
If the lookup or download fails, the release has no Template_v4 archive, or the download does not match what the release publishes for it. |
PackagingError
|
If extraction fails, the archive lacks the Template_v4 entries NAPT builds from, or the cache cannot be written. |
ConfigError
|
If release_spec is invalid. |
Example
Get latest version:
from pathlib import Path
psadt = get_psadt_release("latest", Path("cache/psadt"))
print(psadt) # Output: cache/psadt/4.1.7
Get specific version:
Source code in napt/psadt/release.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |