Skip to content

Commit

Permalink
Refactor install venv for arHttp
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaScheller committed Oct 28, 2023
1 parent 8292f2e commit 9551729
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 56 deletions.
49 changes: 0 additions & 49 deletions tools/debug.py

This file was deleted.

22 changes: 15 additions & 7 deletions tools/update_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,25 @@ def install_side_effect_httpResolver(platform_name, software_name, resolver_dir_
)

demo_dir_path = os.path.join(resolver_dir_path, "demo")
if not os.path.exists(demo_dir_path):
os.makedirs(demo_dir_path)
python_exe = os.path.join(os.environ["HFS"], "python", "bin", "python")

# Create venv
subprocess.check_call([python_exe, "-m", "venv", "venv"], cwd=demo_dir_path)
subprocess.check_call([python_exe, "-m", "venv", "venv"], cwd=demo_dir_path, env={})
venv_python_exe = os.path.join(demo_dir_path, "venv", "bin", "python")
# Install deps (We can't use the pyproject.toml as it depends on .git)
subprocess.check_call([venv_python_exe, "-m", "pip", "install", "fastapi[all]"], cwd=demo_dir_path)
subprocess.check_call([venv_python_exe, "-m", "pip", "install", "fastapi[all]"], cwd=demo_dir_path, env={})
# Command
if platform_name == "linux":
command = "{} uvicorn arHttpSampleServer:app --reload &".format(venv_python_exe)
venv_uvicorn_exe = os.path.join(demo_dir_path, "venv", "bin", "uvicorn")
command = "{} arHttpSampleServer:app --reload &".format(venv_uvicorn_exe)
elif platform_name == "win64":
command = ""
command = 'start "ArHttp Webserver" {} arHttpSampleServer:app --reload'.format(venv_uvicorn_exe)
return command


INSTALL_SIDE_EFFECTS = {"httpResolver": install_side_effect_httpResolver}
INSTALL_SIDE_EFFECTS = {"fileResolver": install_side_effect_httpResolver}


class UpdateManagerUI(QtWidgets.QDialog):
Expand Down Expand Up @@ -273,7 +276,7 @@ def uninstall_button_clicked(self):
answer = QtWidgets.QMessageBox.information(
self,
QT_WINDOW_TITLE,
"Uninstall successfull. Please restart the application.\nDo you want to alternatively reinstall a different release? ",
"Uninstall successful. Please restart the application.\nDo you want to alternatively reinstall a different release? ",
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel,
)
if answer == QtWidgets.QMessageBox.Yes:
Expand Down Expand Up @@ -503,6 +506,11 @@ def install_release(
)
directory_path = self.uncompress_file(download_file_path)
resolver_dir_path = os.path.join(directory_path, resolver_name)
# Cleanup other resolvers
for dir_name in os.listdir(directory_path):
if dir_name != resolver_name:
os.rmdir(os.path.join(directory_path, dir_name))
# Build launcher
env = {
"PXR_PLUGINPATH_NAME": os.path.join(resolver_dir_path, "resources"),
"PYTHONPATH": os.path.join(resolver_dir_path, "lib", "python"),
Expand Down Expand Up @@ -531,7 +539,7 @@ def install_release(
env_name=env_name, env_value=env_value, sep=os.pathsep
)
)
# Side effect command
# Side effect command
if side_effect_command:
lines.append(side_effect_command)
# App
Expand Down

0 comments on commit 9551729

Please sign in to comment.