From 20c02089b6f279d1bb49c49be9abb94e71d7d6ef Mon Sep 17 00:00:00 2001 From: haixuanTao Date: Mon, 8 Jan 2024 14:33:03 +0100 Subject: [PATCH] Fix Python CI on windows --- .github/workflows/ci.yml | 2 +- examples/python-dataflow/run.rs | 8 +++++++- examples/python-operator-dataflow/run.rs | 8 +++++++- examples/python-ros2-dataflow/run.rs | 8 +++++++- libraries/core/src/lib.rs | 2 +- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1af7e115..f677d0e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: workflow_dispatch: env: - RUST_LOG: trace + RUST_LOG: INFO jobs: test: diff --git a/examples/python-dataflow/run.rs b/examples/python-dataflow/run.rs index 74fcd1fb..16e9d2d6 100644 --- a/examples/python-dataflow/run.rs +++ b/examples/python-dataflow/run.rs @@ -24,7 +24,13 @@ async fn main() -> eyre::Result<()> { venv.to_str().context("venv path not valid unicode")?, ); let orig_path = std::env::var("PATH")?; - let venv_bin = venv.join("bin"); + // bin folder is named Scripts on windows. + // 🤦‍♂️ See: https://github.com/pypa/virtualenv/commit/993ba1316a83b760370f5a3872b3f5ef4dd904c1 + let venv_bin = if cfg!(windows) { + venv.join("Scripts") + } else { + venv.join("bin") + }; std::env::set_var( "PATH", format!( diff --git a/examples/python-operator-dataflow/run.rs b/examples/python-operator-dataflow/run.rs index 7554a5e2..4cb19c6d 100644 --- a/examples/python-operator-dataflow/run.rs +++ b/examples/python-operator-dataflow/run.rs @@ -24,7 +24,13 @@ async fn main() -> eyre::Result<()> { venv.to_str().context("venv path not valid unicode")?, ); let orig_path = std::env::var("PATH")?; - let venv_bin = venv.join("bin"); + // bin folder is named Scripts on windows. + // 🤦‍♂️ See: https://github.com/pypa/virtualenv/commit/993ba1316a83b760370f5a3872b3f5ef4dd904c1 + let venv_bin = if cfg!(windows) { + venv.join("Scripts") + } else { + venv.join("bin") + }; std::env::set_var( "PATH", format!( diff --git a/examples/python-ros2-dataflow/run.rs b/examples/python-ros2-dataflow/run.rs index 26f61224..f136ae46 100644 --- a/examples/python-ros2-dataflow/run.rs +++ b/examples/python-ros2-dataflow/run.rs @@ -24,7 +24,13 @@ async fn main() -> eyre::Result<()> { venv.to_str().context("venv path not valid unicode")?, ); let orig_path = std::env::var("PATH")?; - let venv_bin = venv.join("bin"); + // bin folder is named Scripts on windows. + // 🤦‍♂️ See: https://github.com/pypa/virtualenv/commit/993ba1316a83b760370f5a3872b3f5ef4dd904c1 + let venv_bin = if cfg!(windows) { + venv.join("Scripts") + } else { + venv.join("bin") + }; std::env::set_var( "PATH", format!( diff --git a/libraries/core/src/lib.rs b/libraries/core/src/lib.rs index 4d1420ec..e0145d2b 100644 --- a/libraries/core/src/lib.rs +++ b/libraries/core/src/lib.rs @@ -1,4 +1,4 @@ -use eyre::{bail, eyre, Context, ContextCompat}; +use eyre::{bail, eyre, Context}; use std::{ env::consts::{DLL_PREFIX, DLL_SUFFIX}, ffi::OsStr,