Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the python build when running without web_viewer enabled #1856

Merged
merged 1 commit into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion rerun_py/src/python_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ pub use rerun::{
coordinates::{Axis3, Handedness, Sign, SignedAxis3},
};

#[cfg(feature = "web_viewer")]
use re_web_viewer_server::WebViewerServerPort;
#[cfg(feature = "web_viewer")]
use re_ws_comms::RerunServerPort;

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

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

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

#[cfg(not(feature = "web_viewer"))]
{
_ = open_browser;
_ = port;
Err(PyRuntimeError::new_err(
"The Rerun SDK was not compiled with the 'web_viewer' feature",
))
Expand Down
2 changes: 2 additions & 0 deletions rerun_py/src/python_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use re_log_types::{
RecordingId, RecordingInfo, RecordingSource, RowId, Time, TimePoint,
};

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

#[cfg(feature = "web_viewer")]
#[error("Could not start the WebViewerServer: '{0}'")]
WebViewerServerError(#[from] re_web_viewer_server::WebViewerServerError),
}
Expand Down