Skip to content

Commit b4190d8

Browse files
authored
Fix the python build when running without web_viewer enabled (#1856)
1 parent 13c96bb commit b4190d8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

rerun_py/src/python_bridge.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ pub use rerun::{
3030
coordinates::{Axis3, Handedness, Sign, SignedAxis3},
3131
};
3232

33+
#[cfg(feature = "web_viewer")]
3334
use re_web_viewer_server::WebViewerServerPort;
35+
#[cfg(feature = "web_viewer")]
3436
use re_ws_comms::RerunServerPort;
3537

3638
use crate::{arrow::get_registered_component_names, python_session::PythonSession};
@@ -305,6 +307,7 @@ fn connect(addr: Option<String>) -> PyResult<()> {
305307
}
306308

307309
#[must_use = "the tokio_runtime guard must be kept alive while using tokio"]
310+
#[cfg(feature = "web_viewer")]
308311
fn enter_tokio_runtime() -> tokio::runtime::EnterGuard<'static> {
309312
use once_cell::sync::Lazy;
310313
static TOKIO_RUNTIME: Lazy<tokio::runtime::Runtime> =
@@ -341,6 +344,8 @@ fn serve(open_browser: bool, web_port: Option<u16>, ws_port: Option<u16>) -> PyR
341344

342345
#[cfg(not(feature = "web_viewer"))]
343346
{
347+
_ = web_port;
348+
_ = ws_port;
344349
_ = open_browser;
345350
Err(PyRuntimeError::new_err(
346351
"The Rerun SDK was not compiled with the 'web_viewer' feature",
@@ -362,7 +367,7 @@ fn start_web_viewer_server(port: u16) -> PyResult<()> {
362367

363368
#[cfg(not(feature = "web_viewer"))]
364369
{
365-
_ = open_browser;
370+
_ = port;
366371
Err(PyRuntimeError::new_err(
367372
"The Rerun SDK was not compiled with the 'web_viewer' feature",
368373
))

rerun_py/src/python_session.rs

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use re_log_types::{
66
RecordingId, RecordingInfo, RecordingSource, RowId, Time, TimePoint,
77
};
88

9+
#[cfg(feature = "web_viewer")]
910
use re_web_viewer_server::WebViewerServerPort;
1011
use rerun::sink::LogSink;
1112
// ----------------------------------------------------------------------------
@@ -16,6 +17,7 @@ pub enum PythonSessionError {
1617
#[error("The Rerun SDK was not compiled with the '{0}' feature")]
1718
FeatureNotEnabled(&'static str),
1819

20+
#[cfg(feature = "web_viewer")]
1921
#[error("Could not start the WebViewerServer: '{0}'")]
2022
WebViewerServerError(#[from] re_web_viewer_server::WebViewerServerError),
2123
}

0 commit comments

Comments
 (0)