Skip to content

Commit

Permalink
use python3 uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
dogdogdog committed Jun 9, 2023
1 parent 5d73b0b commit ecbb271
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ use std::{
};

fn uuid() -> Result<String, Box<dyn Error>> {
let proc = Command::new("uuidgen").stdout(Stdio::piped()).output()?;
#[cfg(target_family = "windows")]
let py = "python.exe";
#[cfg(target_family = "unix")]
let py = "python3";
let proc = Command::new(py)
.arg("-c")
.arg("import uuid; print(uuid.uuid4())")
.stdout(Stdio::piped())
.output()?;
assert!(proc.status.success());
let uuid = String::from_utf8(proc.stdout)?.trim().into();
Ok(uuid)
Expand Down

0 comments on commit ecbb271

Please sign in to comment.