From f686bd7b2ec8df47509f39ad447515a021b54405 Mon Sep 17 00:00:00 2001 From: Abdur Rahman Date: Thu, 4 Sep 2025 07:54:49 +0000 Subject: [PATCH] Refactor GDAL installation and version handling Updated GDAL installation commands and added explicit version handling. --- src/main.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index bf0f67f..49d6f9d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -357,15 +357,16 @@ fn main() -> Result<()> { // Install DataPusher+ cmd!(sh, "sudo apt install python3-virtualenv python3-dev python3-pip python3-wheel build-essential libxslt1-dev libxml2-dev zlib1g-dev git libffi-dev libpq-dev uchardet -y").run()?; sh.change_dir("/usr/lib/ckan/default/src"); - // Install GDAL and other geospatial dependencies + // Install GDAL dependencies cmd!(sh, "sudo apt update").run()?; - cmd!(sh, "sudo apt install -y gdal-bin libgdal-dev libproj-dev libgeos-dev").run()?; - - // Set GDAL environment variables for the build - let gdal_version = cmd!(sh, "gdal-config --version").read()?; - std::env::set_var("GDAL_VERSION", gdal_version.trim()); - - cmd!(sh, "pip install -e git+https://github.com/dathere/datapusher-plus.git@main#egg=datapusher-plus").run()?; + cmd!(sh, "sudo apt install -y gdal-bin libgdal-dev libproj-dev libgeos-dev python3-gdal").run()?; + + // Get GDAL version and export it + let gdal_version_output = cmd!(sh, "gdal-config --version").read()?; + let gdal_version = gdal_version_output.trim(); + + // Install with explicit GDAL version + cmd!(sh, "GDAL_VERSION={gdal_version} pip install -e git+https://github.com/dathere/datapusher-plus.git@main#egg=datapusher-plus").run()?; sh.change_dir("/usr/lib/ckan/default/src/datapusher-plus"); cmd!(sh, "pip install -r requirements.txt").run()?; sh.change_dir(format!("/home/{username}"));