Skip to content

Commit

Permalink
Revert if works
Browse files Browse the repository at this point in the history
  • Loading branch information
MaticTonin committed Dec 5, 2024
1 parent 61d9a02 commit f9da163
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 41 deletions.
5 changes: 0 additions & 5 deletions rerun_py/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,4 @@ 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: 0 additions & 29 deletions rerun_py/build.rs
Original file line number Diff line number Diff line change
@@ -1,35 +1,6 @@
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Pyarmor 9.0.6 (pro), 007125, Dynamic-recalibration, 2024-12-05T00:37:10.324494
from .pyarmor_runtime_007125 import __pyarmor__
__pyarmor__(__name__, __file__, b'PY007125\x00\x03\n\x00o\r\r\n\x80\x00\x01\x00\x08\x00\x00\x00\x04\x00\x00\x00@\x00\x00\x00\x88\x00\x00\x00\x12\t\x06\x00\xcb\x11|\xd14\x98\xdb\xef\x03\x80B\'\xf7]\x03/\x00\x00\x00\x00\x00\x00\x00\x000\x85\x947\xf2\xe6\x91nH\xd2)\xbb\xb1\xe6\xaf\x1a"K\x03\xbfWZR\xe0\xe9s\xfe\xacL\xd71\x0c\xb27\x8d%\xaf\x98\xde*\xd9K\xeaO\x9b\x17\xf1sL\xed\xd4\xcc[\xb2\xa9\x90\xc0\x8a?n\x80\xcegC\xc1\x19V\xb3cw\x95\xeaO\xb4\xd2y\x0b\xcf\x81\xd0\xc5\xe4\xce\xb8\x19X\xbc\xa5BP\x17\xeb_\x98\x8c\xa9\x18\xd6\xe4D\x0c\x8a\xff+>\xfa<\x12!\x1d9\x97\xb3Gq8\xcf\x9b\x83\xfe\xc1\xcd\x16\xeb\xda/\xe7\x8c\xfaa\xcf\x8eO\xac\x1fA')

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Pyarmor 9.0.6 (pro), 007125, 2024-12-05T00:57:50.471218
def __pyarmor__():
import platform
import sys
from struct import calcsize

def format_system():
plat = platform.system().lower()
plat = ('cygwin' if plat.startswith('cygwin') else
'linux' if plat.startswith('linux') else
'freebsd' if plat.startswith(
('freebsd', 'openbsd', 'isilon onefs')) else plat)
if plat == 'linux':
if hasattr(sys, 'getandroidapilevel'):
plat = 'android'
else:
cname, cver = platform.libc_ver()
if cname == 'musl':
plat = 'alpine'
elif cname == 'libc':
plat = 'android'
return plat

def format_machine():
mach = platform.machine().lower()
arch_table = (
('x86', ('i386', 'i486', 'i586', 'i686', 'x86')),
('x86_64', ('x64', 'x86_64', 'amd64', 'intel')),
('arm', ('armv5',)),
('armv6', ('armv6l',)),
('armv7', ('armv7l',)),
('aarch32', ('aarch32',)),
('aarch64', ('aarch64', 'arm64')),
('ppc64le', ('ppc64le',)),
('mips32el', ('mipsel', 'mips32el')),
('mips64el', ('mips64el',)),
('riscv64', ('riscv64',)),
)
for alias, archlist in arch_table:
if mach in archlist:
mach = alias
break
return mach

plat, mach = format_system(), format_machine()
if plat == 'windows' and mach == 'x86_64':
bitness = calcsize('P'.encode()) * 8
if bitness == 32:
mach = 'x86'
# mach = 'universal' if plat == 'darwin' else mach
name = '.'.join(['_'.join([plat, mach]), 'pyarmor_runtime'])
return __import__(name, globals(), locals(), ['__pyarmor__'], level=1)
__pyarmor__ = __pyarmor__().__pyarmor__
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 1 addition & 3 deletions 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"]
requires = ["maturin>=0.14.0,<0.15","setuptools", "wheel"]

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

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

0 comments on commit f9da163

Please sign in to comment.