Skip to content

Commit

Permalink
pdal_execute_pipeline: Add an env_overrides kwarg
Browse files Browse the repository at this point in the history
  • Loading branch information
craigds committed Oct 26, 2022
1 parent b8fa11d commit adb2580
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kart/point_cloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
from kart.cli_util import tool_environment


def pdal_execute_pipeline(pipeline):
def pdal_execute_pipeline(pipeline, *, env_overrides=None):
"""
Executes the given PDAL pipeline. Should be a list of dicts/strings, each representing a PDAL stage.
Returns a list of metadata output from each stage.
"""
with tempfile.NamedTemporaryFile() as f_metadata:
env = tool_environment()
# Until we incorporate a vendored PDAL into our build, it might be built against a libproj that
# uses a different proj database than the one we're vendoring.
# So we carefully don't tell it where to look for the proj database.
env.pop("PROJ_LIB", None)
# NOTE: Kart itself doesn't currently use env_overrides, but don't remove it.
# PDAL uses environment variables for various purposes, and this is helpful for `kart ext-run` scripts.
env.update(env_overrides or {})
subprocess.run(
["pdal", "pipeline", "--stdin", f"--metadata={f_metadata.name}"],
check=True,
Expand Down

0 comments on commit adb2580

Please sign in to comment.