Skip to content

Commit

Permalink
Fixed distutils dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
revarbat committed Oct 31, 2024
1 parent 81dd47b commit a90b75f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
39 changes: 21 additions & 18 deletions openscad_runner/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os
import sys
import math
import shutil
import filecmp
import os.path
import platform
import subprocess
import distutils.spawn

from enum import Enum
from PIL import Image, ImageChops
Expand Down Expand Up @@ -112,24 +112,27 @@ def __init__(
- quiet = Suppresses non-error, non-warning messages. Default: False
- verbose = Print the command-line to stdout on each execution. Default: False
"""
if platform.system() == "Darwin":
self.OPENSCAD = "/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD"
exepath = shutil.which("openscad")
if exepath is not None:
self.OPENSCAD = exepath
elif platform.system() == "Darwin":
exepath = shutil.which("/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD")
if exepath is not None:
self.OPENSCAD = exepath
elif platform.system() == "Windows":
if distutils.spawn.find_executable("openscad"):
self.OPENSCAD = "openscad"
else:
test_paths = [
"C:\\Program Files\\openSCAD\\openscad.com",
"C:\\Program Files (x86)\\openSCAD\\openscad.com",
]
for p in test_paths:
if os.path.isfile(p):
self.OPENSCAD = p
break
if not hasattr(self, "OPENSCAD"):
raise Exception("Can't find OpenSCAD executable. Is OpenSCAD on your system PATH?")
else:
self.OPENSCAD = "openscad"
test_paths = [
"C:\\Program Files\\openSCAD\\openscad.com",
"C:\\Program Files\\openSCAD\\openscad.exe",
"C:\\Program Files (x86)\\openSCAD\\openscad.com",
"C:\\Program Files (x86)\\openSCAD\\openscad.exe",
]
for p in test_paths:
exepath = shutil.which(p)
if exepath is not None:
self.OPENSCAD = exepath
break
if not hasattr(self, "OPENSCAD"):
raise Exception("Can't find OpenSCAD executable. Is OpenSCAD on your system PATH?")
self.scriptfile = scriptfile
self.outfile = outfile
self.imgsize = imgsize
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "openscad_runner"
version = "1.1.1"
version = "1.1.2"
authors = [
{ name="Revar Desmera", email="revarbat@gmail.com" },
]
Expand Down

0 comments on commit a90b75f

Please sign in to comment.