Skip to content

Commit

Permalink
osx support
Browse files Browse the repository at this point in the history
  • Loading branch information
ikappaki committed Jul 31, 2024
1 parent 244a75a commit 5b97c5c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
37 changes: 30 additions & 7 deletions scripts/blender_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
elif system == 'Linux':
filename = f'blender-{version}-linux-x64.tar.xz'
extension = ".tar.xz"
elif system == "Darwin":
filename = f'blender-{version}-macos-arm64.dmg'
extension = ".dmg"

assert filename, f":error :system-unsupported {system}"
assert extension
Expand All @@ -53,20 +56,40 @@
print(f"\n:download :done")
assert os.path.exists(filename_path)

extract_dir = os.path.join(tmp_dir, filename[:filename.rfind(extension)])
print(f'\n:extracting {filename_path} :to {tmp_dir} :as {extract_dir}')
if system == 'Darwing':
extract_base = "/Volumes"
extract_dir = "/Volumes/Blender/Blender.app"
else:
extract_base = tmp_dir
extract_dir = os.path.join(tmp_dir, filename[:filename.rfind(extension)])

print(f'\n:extracting {filename_path} :to {extract_base} :as {extract_dir}')
if system == 'Windows':
import zipfile
with zipfile.ZipFile(filename_path) as zip_ref:
zip_ref.extractall(tmp_dir)
zip_ref.extractall(extract_base)
elif system == 'Linux':
import tarfile
with tarfile.open(filename_path) as tar:
tar.extractall(path=tmp_dir)
tar.extractall(path=extract_base)
elif system == "Darwin":
import subprocess
result = subprocess.run(['hdiutil', 'attach', filename_path],
check=True,
capture_output=True,
text=True)
print(f":process :stdout {result.stdout}")
print(f":process :stderr {result.stderr}")
extract_dir = "/Volumes/Blender/Blender.app"
print(f":extract :done")
assert os.path.exists(extract_dir)

print(f'\n:moving {extract_dir} :to {outdir_abs}')
shutil.move(extract_dir, outdir_abs)
print(f":move :done")
if system == "Darwin":
print(f'\n:copying {extract_dir} :to {outdir_abs}')
shutil.copytree(extract_dir, outdir_abs)
print(f":copying :done")
else:
print(f'\n:moving {extract_dir} :to {outdir_abs}')
shutil.move(extract_dir, outdir_abs)
print(f":move :done")
assert(outdir_abs)
4 changes: 4 additions & 0 deletions src/dev/dev_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
import shutil

ENV_BLENDER_HOME_ = "BB_BLENDER_TEST_HOME"
Expand All @@ -11,6 +12,9 @@ def blender_home_get():

def blender_exec_path_get():
blender_home_abs = blender_home_get()
if platform.system() == 'Darwin':
blender_home_abs = os.path.join(blender_home_abs, "Contents/MacOS")

exec_path = None
envpath = os.environ.get('PATH', '')
envpath_new = blender_home_abs
Expand Down
2 changes: 1 addition & 1 deletion tests/basilisp_blender/integration/int_nrepl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def nrepl_client_test():

client_thread = threading.Thread(target=nrepl_client_test, daemon=True)
client_thread.start()
client_thread.join(timeout=10)
client_thread.join(timeout=20)
assert not client_thread.is_alive()
process.terminate()
out, error = process.communicate()
Expand Down

0 comments on commit 5b97c5c

Please sign in to comment.