diff --git a/nbdev/quarto.py b/nbdev/quarto.py index 5735ce000..cca61af5c 100644 --- a/nbdev/quarto.py +++ b/nbdev/quarto.py @@ -3,7 +3,7 @@ # %% ../nbs/api/14_quarto.ipynb 3 from __future__ import annotations import subprocess,sys,shutil,ast,warnings,traceback -from os import system +from os import system, uname from contextlib import contextmanager from .config import * @@ -29,8 +29,9 @@ def _sprun(cmd): BASE_QUARTO_URL='https://www.quarto.org/download/latest/' def _install_linux(): - system(f'curl -LO {BASE_QUARTO_URL}quarto-linux-amd64.deb') - system('sudo dpkg -i quarto-linux-amd64.deb && rm quarto-linux-amd64.deb') + machine = 'arm' if uname().machine in ('arm64', 'aarch64', 'armv8', 'armv8l') else 'amd' + system(f'curl -LO {BASE_QUARTO_URL}quarto-linux-{machine}64.deb') + system(f'sudo dpkg -i quarto-linux-{machine}64.deb && rm quarto-linux-{machine}64.deb') def _install_mac(): system(f'curl -LO {BASE_QUARTO_URL}quarto-macos.pkg') diff --git a/nbs/api/14_quarto.ipynb b/nbs/api/14_quarto.ipynb index 0d4b54ef2..b1fd4505d 100644 --- a/nbs/api/14_quarto.ipynb +++ b/nbs/api/14_quarto.ipynb @@ -39,7 +39,7 @@ "#|export\n", "from __future__ import annotations\n", "import subprocess,sys,shutil,ast,warnings,traceback\n", - "from os import system\n", + "from os import system, uname\n", "from contextlib import contextmanager\n", "\n", "from nbdev.config import *\n", @@ -96,8 +96,9 @@ "BASE_QUARTO_URL='https://www.quarto.org/download/latest/'\n", "\n", "def _install_linux():\n", - " system(f'curl -LO {BASE_QUARTO_URL}quarto-linux-amd64.deb')\n", - " system('sudo dpkg -i quarto-linux-amd64.deb && rm quarto-linux-amd64.deb')\n", + " machine = 'arm' if uname().machine in ('arm64', 'aarch64', 'armv8', 'armv8l') else 'amd'\n", + " system(f'curl -LO {BASE_QUARTO_URL}quarto-linux-{machine}64.deb')\n", + " system(f'sudo dpkg -i quarto-linux-{machine}64.deb && rm quarto-linux-{machine}64.deb')\n", " \n", "def _install_mac():\n", " system(f'curl -LO {BASE_QUARTO_URL}quarto-macos.pkg')\n",