stratified_packager.processing.bundling
Auxiliary file bundling: data/ payloads and resources/ style assets (SPEC §14).
Runs on the algorithm thread during Phase A. Whole-export local file-based raster, mesh
and point-cloud layers contribute their source file plus sidecars (or the whole
directory for directory-based sources) under data/<table name>/; files referenced by
included layers’ symbology land under resources/ — keeping their project-relative
subtree, or resources/_ext/<hash8>_<name> for files outside the project home. Paths
inside QGIS-builtin resource locations are never bundled (they resolve on any install).
Module Attributes
Zip-root directory of layer payloads (SPEC §10). |
|
Zip-root directory of style assets (SPEC §10). |
Functions
|
Name the other project layers backed by the same container file (SPEC §14 caveat). |
|
Collect one whole-export layer's |
|
Return the layer's local source path, when its provider exposes one. |
|
Return the zip-internal path an embedded project re-points this payload layer at (§13). |
|
Rewrite bundled asset paths inside a QML (or project XML) document (SPEC §14). |
|
Map every bundleable style-asset path to its |
- class stratified_packager.processing.bundling._SymbolPathCollector[source]
Collects file paths referenced by a layer’s style entities (SPEC §14).
- _harvest_text_format(owner)[source]
Harvest the background SVG of a text format (or of label settings).
- _walk_symbol(symbol)[source]
Recurse through a symbol’s layers (and sub-symbols), harvesting paths.
Name the other project layers backed by the same container file (SPEC §14 caveat).
Copying a container (e.g. a GeoPackage) under
data/drags every layer it holds; the caller warns when this list is non-empty.- Parameters:
layer (
QgsMapLayer) – The whole-export layer about to be copied.project (
QgsProject) – The project to scan.
- Return type:
- Returns:
Names of other layers sharing the source file, sorted.
- stratified_packager.processing.bundling.data_payload_members(layer, table, feedback)[source]
Collect one whole-export layer’s
data/zip members (SPEC §14).File sources contribute the file plus its sidecars (
sidecarFilesForPath()); directory-based sources (e.g. ESRI grid) are copied whole.- Parameters:
layer (
QgsMapLayer) – The raster/mesh/point-cloud layer.table (
str) – The layer’s table name (thedata/<table>/subdirectory).feedback (
QgsProcessingFeedback) – Execution feedback channel.
- Return type:
- Returns:
(source file, arcname)pairs; empty when the source is not a local file (such layers ride only in the embedded project).
- stratified_packager.processing.bundling.local_source_path(layer)[source]
Return the layer’s local source path, when its provider exposes one.
Also the payload-classification test: a raster/mesh/point-cloud layer is a
data/payload (SPEC §14) iff this returns a path.- Parameters:
layer (
QgsMapLayer) – Any map layer.- Return type:
- Returns:
The decoded
pathcomponent, orNonefor non-file sources.
- stratified_packager.processing.bundling.payload_source_arcname(layer, table)[source]
Return the zip-internal path an embedded project re-points this payload layer at (§13).
For a plain file source this is the copied main file’s arcname; for a directory-based source (e.g. an ESRI grid) it is the copied directory — never one of the files inside it, which GDAL may not open as the dataset.
- Parameters:
layer (
QgsMapLayer) – The raster/mesh/point-cloud layer.table (
str) – The layer’s table name (thedata/<table>/subdirectory).
- Return type:
- Returns:
The
data/<table>/<source name>arcname, or empty for non-file sources.
- stratified_packager.processing.bundling.rewrite_asset_paths(document, mapping, to_root)[source]
Rewrite bundled asset paths inside a QML (or project XML) document (SPEC §14).
Each original path is replaced by its bundled location, made relative to the document’s directory inside the zip via to_root (empty at the zip root,
../per directory level below it). Both the original spelling and its slash-normalized variant are replaced.
- stratified_packager.processing.bundling.style_asset_mapping(layers, project_home, feedback)[source]
Map every bundleable style-asset path to its
resources/arcname (SPEC §14).Files under the project home keep their project-relative subtree; foreign files land in
resources/_ext/<hash8>_<name>(hash of the absolute source path). Paths under the QGIS-builtin resource locations (svgPaths()and the application prefix) are skipped.- Parameters:
layers (
Iterable[QgsMapLayer]) – The included layers.project_home (
Path|None) – The project home directory (absolute), orNone.feedback (
QgsProcessingFeedback) – Execution feedback channel.
- Return type:
- Returns:
original path -> arcnamefor every existing, non-builtin asset.
- stratified_packager.processing.bundling.DATA_PREFIX: Final = 'data'
Zip-root directory of layer payloads (SPEC §10).
- stratified_packager.processing.bundling.RESOURCES_PREFIX: Final = 'resources'
Zip-root directory of style assets (SPEC §10).