mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-27 17:06:31 +08:00
Python virtual environment (#3305)
* [python] setup venv and update pprzlink. * [supervision] open terminal in the venv if it exists. * clean setup.py * guard venv boostrap * [install] Use distro instead of lsb_release. --------- Co-authored-by: Fabien-B <Fabien-B@github.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import subprocess
|
||||
from PyQt5.QtWidgets import *
|
||||
from typing import NamedTuple
|
||||
from PyQt5.QtCore import QSettings
|
||||
import subprocess
|
||||
|
||||
|
||||
class GConfEntry(NamedTuple):
|
||||
@@ -66,16 +67,17 @@ def get_build_version() -> str:
|
||||
version = f.readline().strip()
|
||||
return version
|
||||
|
||||
def get_shell():
|
||||
p = subprocess.run(['getent', 'passwd', os.getenv('LOGNAME')], capture_output=True)
|
||||
shell = p.stdout.decode().strip().split(':')[6]
|
||||
return shell
|
||||
|
||||
def open_terminal(wd, command=None):
|
||||
cmd = ""
|
||||
if command is not None:
|
||||
cmd = " -- {}".format(command)
|
||||
def open_terminal(wd):
|
||||
terminal_emulator = get_settings().value("terminal_emulator", "", str)
|
||||
if terminal_emulator == "":
|
||||
terminal_emulator = "gnome-terminal"
|
||||
os.system("{}".format(terminal_emulator))
|
||||
|
||||
terminal_emulator = "x-terminal-emulator"
|
||||
shell = get_shell()
|
||||
subprocess.Popen([terminal_emulator, '-e', shell, '--rcfile', 'conf/system/term_init.sh'], cwd=wd)
|
||||
|
||||
def get_settings() -> QSettings:
|
||||
return QSettings(os.path.join(CONF_DIR, "pprz_center_settings.ini"), QSettings.IniFormat)
|
||||
|
||||
Reference in New Issue
Block a user