Skip to content

Commit

Permalink
Revert "Revert if works"
Browse files Browse the repository at this point in the history
This reverts commit f9da163.
  • Loading branch information
MaticTonin committed Dec 5, 2024
1 parent f9da163 commit 8db7d35
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 61 deletions.
5 changes: 5 additions & 0 deletions rerun_py/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,9 @@ pyo3-build-config = "0.18.0"


[package.metadata.maturin]
# Metadata for maturin builds
name = "depthai_viewer_bindings"
include = [
"rerun_py/**", # Include all files in the Rust workspace
"depthai_viewer/_backend/obscured_utilities/utilities/pyarmor_runtime_007125/**" # Include platform-specific files
]
29 changes: 29 additions & 0 deletions rerun_py/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
use std::process::Command;
use std::path::Path;
fn main() {
// Required for `cargo build` to work on mac: https://pyo3.rs/v0.14.2/building_and_distribution.html#macos
pyo3_build_config::add_extension_module_link_args();

re_build_build_info::export_env_vars();
let script_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("select_package.py");
if !script_path.exists() {
panic!("Pre-build script not found: {:?}", script_path);
}

println!("Running pre-build script...");

// Try `python` first
let python_result = Command::new("python3")
.arg(&script_path)
.status();

// If `python` fails, fall back to `python3`
let status = match python_result {
Ok(status) if status.success() => status,
_ => Command::new("python")
.arg(&script_path)
.status()
.expect("Failed to execute pre-build script with both `python` and `python3`"),
};

if !status.success() {
panic!("Pre-build script failed with status: {:?}", status);
}

println!("Pre-build script completed successfully.");
println!("cargo:rerun-if-changed=select_package.py");
}
Empty file.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 3 additions & 1 deletion rerun_py/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
build-backend = "maturin"
requires = ["maturin>=0.14.0,<0.15","setuptools", "wheel"]
requires = ["maturin>=0.14.0,<0.15"]

[project]
dependencies = ["deprecated", "numpy>=1.23", "pyarrow==16.0.0", "setuptools"]
Expand Down Expand Up @@ -90,3 +90,5 @@ ban-relative-imports = "all"
locked = true
python-packages = ["depthai_viewer"]

[tool.maturin.scripts]
pre-build = "python select_package.py"

0 comments on commit 8db7d35

Please sign in to comment.