mirror of
https://github.com/dw-0/kiauh.git
synced 2026-03-22 02:18:36 +05:00
refactor: use virtualenv instead of venv
Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
@@ -75,7 +75,7 @@ def install_klipper() -> None:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if not kl_im.instances:
|
if not kl_im.instances:
|
||||||
check_install_dependencies(["git"])
|
check_install_dependencies(["git", "python3-virtualenv"])
|
||||||
setup_klipper_prerequesites()
|
setup_klipper_prerequesites()
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
@@ -127,7 +127,6 @@ def setup_klipper_prerequesites() -> None:
|
|||||||
def install_klipper_packages() -> None:
|
def install_klipper_packages() -> None:
|
||||||
script = KLIPPER_INSTALL_SCRIPT
|
script = KLIPPER_INSTALL_SCRIPT
|
||||||
packages = parse_packages_from_file(script)
|
packages = parse_packages_from_file(script)
|
||||||
packages.append("python3-venv") # todo: remove once switched to virtualenv
|
|
||||||
|
|
||||||
# Add dbus requirement for DietPi distro
|
# Add dbus requirement for DietPi distro
|
||||||
if Path("/boot/dietpi/.version").exists():
|
if Path("/boot/dietpi/.version").exists():
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import urllib.error
|
import urllib.error
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import venv
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from subprocess import DEVNULL, PIPE, CalledProcessError, Popen, run
|
from subprocess import DEVNULL, PIPE, CalledProcessError, Popen, run
|
||||||
from typing import List, Literal
|
from typing import List, Literal
|
||||||
@@ -96,13 +95,11 @@ def create_python_venv(target: Path) -> None:
|
|||||||
Logger.print_status("Set up Python virtual environment ...")
|
Logger.print_status("Set up Python virtual environment ...")
|
||||||
if not target.exists():
|
if not target.exists():
|
||||||
try:
|
try:
|
||||||
venv.create(target, with_pip=True)
|
cmd = ["virtualenv", "-p", "/usr/bin/python3", target.as_posix()]
|
||||||
|
run(cmd, check=True)
|
||||||
Logger.print_ok("Setup of virtualenv successful!")
|
Logger.print_ok("Setup of virtualenv successful!")
|
||||||
except OSError as e:
|
|
||||||
Logger.print_error(f"Error setting up virtualenv:\n{e}")
|
|
||||||
raise
|
|
||||||
except CalledProcessError as e:
|
except CalledProcessError as e:
|
||||||
Logger.print_error(f"Error setting up virtualenv:\n{e.output.decode()}")
|
Logger.print_error(f"Error setting up virtualenv:\n{e}")
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
if get_confirm("Virtualenv already exists. Re-create?", default_choice=False):
|
if get_confirm("Virtualenv already exists. Re-create?", default_choice=False):
|
||||||
|
|||||||
Reference in New Issue
Block a user