check if openscad is installed on system
This commit is contained in:
1 parent
bcb20a9a5d
commit
ec1939a2e1
6 files changed
+22
-11
No files matched your search
Regular → Executable
+3
-1
@@ -5,7 +5,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from utils import ask_float
|
from utils import ask_float, check_openscad
|
||||||
|
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).resolve().parent
|
BASE_DIR = Path(__file__).resolve().parent
|
||||||
@@ -42,6 +42,8 @@ def render_scad(scad_file: Path, out_file: Path, base_radius: float, wall_height
|
|||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
check_openscad()
|
||||||
|
|
||||||
if not SCAD_DIR.exists():
|
if not SCAD_DIR.exists():
|
||||||
raise SystemExit(f"Missing SCAD directory: {SCAD_DIR}")
|
raise SystemExit(f"Missing SCAD directory: {SCAD_DIR}")
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
+3
-1
@@ -5,7 +5,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from utils import ask_float
|
from utils import ask_float, check_openscad
|
||||||
|
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).resolve().parent
|
BASE_DIR = Path(__file__).resolve().parent
|
||||||
@@ -49,6 +49,8 @@ def render_scad(
|
|||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
check_openscad()
|
||||||
|
|
||||||
if not SCAD_DIR.exists():
|
if not SCAD_DIR.exists():
|
||||||
raise SystemExit(f"Missing SCAD directory: {SCAD_DIR}")
|
raise SystemExit(f"Missing SCAD directory: {SCAD_DIR}")
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
+3
-1
@@ -6,7 +6,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from utils import ask_float, ask_int, ask_yes_no
|
from utils import ask_float, ask_int, ask_yes_no, check_openscad
|
||||||
|
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).resolve().parent
|
BASE_DIR = Path(__file__).resolve().parent
|
||||||
@@ -70,6 +70,8 @@ def render_scad(
|
|||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
check_openscad()
|
||||||
|
|
||||||
if not SCAD_DIR.exists():
|
if not SCAD_DIR.exists():
|
||||||
raise SystemExit(f"Missing SCAD directory: {SCAD_DIR}")
|
raise SystemExit(f"Missing SCAD directory: {SCAD_DIR}")
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
+3
-1
@@ -5,7 +5,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from utils import ask_int, ask_float
|
from utils import ask_int, ask_float, check_openscad
|
||||||
|
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).resolve().parent
|
BASE_DIR = Path(__file__).resolve().parent
|
||||||
@@ -54,6 +54,8 @@ def render_scad(
|
|||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
check_openscad()
|
||||||
|
|
||||||
if not SCAD_DIR.exists():
|
if not SCAD_DIR.exists():
|
||||||
raise SystemExit(f"Missing SCAD directory: {SCAD_DIR}")
|
raise SystemExit(f"Missing SCAD directory: {SCAD_DIR}")
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/bin/python3
|
#!/bin/python3
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
|
||||||
def ask_int(prompt: str) -> int:
|
def ask_int(prompt: str) -> int:
|
||||||
@@ -39,3 +40,10 @@ def ask_yes_no(prompt: str) -> bool:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
print("Please enter yes or no. [y/n]")
|
print("Please enter yes or no. [y/n]")
|
||||||
|
|
||||||
|
def check_openscad() -> None:
|
||||||
|
if shutil.which("openscad") is None:
|
||||||
|
raise SystemExit(
|
||||||
|
"OpenSCAD was not found in PATH. "
|
||||||
|
"Install OpenSCAD or make sure the 'openscad' command is available."
|
||||||
|
)
|
||||||
+2
-7
@@ -1,12 +1,11 @@
|
|||||||
#!/bin/python3
|
#!/bin/python3
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import shutil
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from utils import ask_float
|
from utils import ask_float, check_openscad
|
||||||
|
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).resolve().parent
|
BASE_DIR = Path(__file__).resolve().parent
|
||||||
@@ -58,11 +57,7 @@ def render_scad(
|
|||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
if shutil.which("openscad") is None:
|
check_openscad()
|
||||||
raise SystemExit(
|
|
||||||
"OpenSCAD was not found in PATH. "
|
|
||||||
"Install OpenSCAD or make sure the 'openscad' command is available."
|
|
||||||
)
|
|
||||||
|
|
||||||
scad_file = SCAD_DIR / "weave_planter.scad"
|
scad_file = SCAD_DIR / "weave_planter.scad"
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user