Skip to content

Commit

Permalink
fix(installer): Fix build failing due to replicate and other issues (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
KIRA009 authored May 22, 2024
1 parent 52ef728 commit fdf286c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
13 changes: 11 additions & 2 deletions openadapt/app/dashboard/app/recordings/detail/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { ActionEvent as ActionEventType } from "@/types/action-event";
import { Recording as RecordingType } from "@/types/recording";
import { Box, Loader, Progress } from "@mantine/core";
import { useSearchParams } from "next/navigation";
import { useEffect, useState } from "react";
import { Suspense, useEffect, useState } from "react";

export default function Recording() {
function Recording() {
const searchParams = useSearchParams();
const id = searchParams.get("id");
const [recordingInfo, setRecordingInfo] = useState<{
Expand Down Expand Up @@ -95,3 +95,12 @@ function addIdToNullActionEvent(actionEvent: ActionEventType): ActionEventType {
children,
}
}


export default function RecordingPage() {
return (
<Suspense>
<Recording />
</Suspense>
)
}
12 changes: 12 additions & 0 deletions openadapt/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
import subprocess
import sys

import gradio_client
import nicegui
import oa_pynput
import pydicom
import spacy_alignments
import ultralytics

from openadapt.config import POSTHOG_HOST, POSTHOG_PUBLIC_KEY

Expand All @@ -30,6 +32,8 @@ def main() -> None:
oa_pynput,
pydicom,
spacy_alignments,
gradio_client,
ultralytics,
]
if sys.platform == "win32":
additional_packages_to_install.append(screen_recorder_sdk)
Expand All @@ -38,6 +42,10 @@ def main() -> None:
"py",
]

packages_metadata_to_copy = [
"replicate",
]

OPENADAPT_DIR = Path(__file__).parent
ROOT_DIR = OPENADAPT_DIR.parent

Expand Down Expand Up @@ -137,6 +145,10 @@ def main() -> None:
spec.append("--exclude-module")
spec.append(package)

for package in packages_metadata_to_copy:
spec.append("--copy-metadata")
spec.append(package)

subprocess.call(spec)

# building
Expand Down
5 changes: 2 additions & 3 deletions openadapt/build_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@ def is_running_from_executable() -> bool:
class RedirectOutput:
"""Context manager to redirect stdout and stderr to /dev/null."""

null_stream = open(os.devnull, "a")

def __enter__(self) -> "RedirectOutput":
"""Redirect stdout and stderr to /dev/null."""
if is_running_from_executable():
null_stream = open(os.devnull, "a")
self.old_stdout = sys.stdout
self.old_stderr = sys.stderr
sys.stdout = sys.stderr = self.null_stream
sys.stdout = sys.stderr = null_stream
return self

def __exit__(self, exc_type: type, exc_value: Exception, traceback: type) -> None:
Expand Down

0 comments on commit fdf286c

Please sign in to comment.