Fix bin/generate with no features
This commit is contained in:
parent
97f1011748
commit
1f0b053872
@ -1,14 +1,13 @@
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
use std::path::Path;
|
||||
pub const BDK_UDL: &str = "src/bdk.udl";
|
||||
|
||||
const BDK_UDL: &str = "src/bdk.udl";
|
||||
|
||||
fn fixup_python_lib_path<O: AsRef<Path>>(
|
||||
#[cfg(feature = "generate-python")]
|
||||
fn fixup_python_lib_path<O: AsRef<std::path::Path>>(
|
||||
out_dir: O,
|
||||
lib_name: &str,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
|
||||
const LOAD_INDIRECT_DEF: &str = "def loadIndirect():";
|
||||
|
||||
let bindings_file = out_dir.as_ref().join("bdk.py");
|
||||
@ -40,7 +39,10 @@ def _loadIndirectOld():"#,
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "generate-python")]
|
||||
fn generate_python() -> Result<(), Box<dyn std::error::Error>> {
|
||||
use std::env;
|
||||
|
||||
let out_path = env::var("GENERATE_PYTHON_BINDINGS_OUT")
|
||||
.map_err(|_| String::from("`GENERATE_PYTHON_BINDINGS_OUT` env variable missing"))?;
|
||||
uniffi_bindgen::generate_bindings(&format!("{}/{}", env!("CARGO_MANIFEST_DIR"), BDK_UDL), None, vec!["python"], Some(&out_path), false)?;
|
||||
@ -53,5 +55,7 @@ fn generate_python() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
generate_python()
|
||||
#[cfg(feature = "generate-python")]
|
||||
generate_python()?;
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user