diff --git a/CHANGES.md b/CHANGES.md
index ef07555d..15fe30ac 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,6 +2,9 @@
## Unreleased
+- Upgrade `semver` to 1.0 and trim gdal version output in `build.rs`.
+ -
+
- **Breaking**: Make `set_attribute_filter` and `clear_attribute_filter` take `&mut self`
-
diff --git a/Cargo.toml b/Cargo.toml
index b61de627..d0857fd5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,7 +27,7 @@ bitflags = "1.2"
[build-dependencies]
gdal-sys = { path = "gdal-sys", version= "^0.4"}
-semver = "0.11"
+semver = "1.0"
[dev-dependencies]
tempfile = "3.2"
diff --git a/build.rs b/build.rs
index 93da50e5..004310fd 100644
--- a/build.rs
+++ b/build.rs
@@ -20,7 +20,8 @@ fn main() {
let gdal_version_string = gdal_version_info("--version"); // This expects GDAL to repond with "GDAL Semver , RELEASE DATE"
println!("GDAL version string: \"{}\"", gdal_version_string);
- let semver_substring = &gdal_version_string[4..gdal_version_string.find(',').unwrap_or(12)];
+ let semver_substring =
+ &gdal_version_string[4..gdal_version_string.find(',').unwrap_or(12)].trim();
println!("GDAL semver string: \"{}\"", semver_substring);
let detected_version = Version::parse(semver_substring).expect("Could not parse gdal version!");
diff --git a/gdal-sys/Cargo.toml b/gdal-sys/Cargo.toml
index 4388b675..7c12ea76 100644
--- a/gdal-sys/Cargo.toml
+++ b/gdal-sys/Cargo.toml
@@ -13,4 +13,4 @@ libc = "0.2"
[build-dependencies]
bindgen = { version = "0.59", optional = true }
pkg-config = "0.3"
-semver = "0.11"
+semver = "1.0"
diff --git a/gdal-sys/build.rs b/gdal-sys/build.rs
index 9c9ebbd5..aea35445 100644
--- a/gdal-sys/build.rs
+++ b/gdal-sys/build.rs
@@ -101,7 +101,7 @@ fn main() {
let home_dir = env_dir("GDAL_HOME");
let mut version = env::var_os("GDAL_VERSION")
.map(|vs| vs.to_string_lossy().to_string())
- .and_then(|vs| Version::parse(&vs).ok());
+ .and_then(|vs| Version::parse(vs.trim()).ok());
let mut found = false;
if cfg!(windows) {
@@ -195,7 +195,7 @@ fn main() {
include_paths.push(dir.to_str().unwrap().to_string());
}
if version.is_none() {
- if let Ok(pkg_version) = Version::parse(&gdal.version) {
+ if let Ok(pkg_version) = Version::parse(gdal.version.trim()) {
version.replace(pkg_version);
}
}