From 43273cc170b951c0f56c62fd076c9eeb9c199eb8 Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Mon, 18 Sep 2023 22:30:25 -0500 Subject: [PATCH] Switch from `python3` to `python` on Windows and just make other things nicer I dunno --- Readme.md | 10 +++++----- orca | 7 +++++++ orca.bat | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Readme.md b/Readme.md index 4dba169..9233cd5 100644 --- a/Readme.md +++ b/Readme.md @@ -23,15 +23,15 @@ To learn more about the project and its goals, read the [announcement post](http The Orca command-line tools must be installed to your system in order to use them in your own projects. -**At this early stage, you must build Orca yourself - in the future, this installation process will be streamlined.** +**At this early stage, you must build Orca yourself - in the future, there will be fewer dependencies and this installation process will be streamlined.** ### Requirements - Windows or Mac (Linux is not yet supported) -- [Python 3](https://www.python.org/) (for command line tools) +- [Python 3.8](https://www.python.org/) or newer (for command line tools) - Clang - **Windows users:** `clang` can be installed via the Visual Studio installer. Search for "C++ Clang Compiler". - - **Mac users:** Apple's built-in `clang` does not support WebAssembly. We recommend installing `clang` via [Homebrew](https://brew.sh/) with `brew install clang`. + - **Mac users:** Apple's built-in `clang` does not support WebAssembly. We recommend installing `clang` via [Homebrew](https://brew.sh/) with `brew install llvm`. - MSVC (Visual Studio 2022 17.5 or newer) (Windows only) - This can be installed through the [Visual Studio Community](https://visualstudio.microsoft.com/) installer. Ensure that your Visual Studio installation includes "Desktop development with C++". - Please note the version requirement! Orca requires C11 atomics, which were only added to MSVC in late 2022. @@ -50,13 +50,13 @@ cd orca Build the Orca runtime: ``` -./orca dev build-runtime +python orca dev build-runtime ``` Install the Orca dev tools. If on Windows, the tool can automatically add `orca` to your PATH. Otherwise, you must manually add the Orca install directory to your PATH, e.g. by updating `.zshrc` or `.bashrc`. ``` -./orca dev install +python orca dev install ``` Finally, verify that Orca is successfully installed by running the `orca version` command. Note the lack of `./`! diff --git a/orca b/orca index c973d97..650ca33 100755 --- a/orca +++ b/orca @@ -7,10 +7,17 @@ import os import sys +MAJOR, MINOR = 3, 8 + if __name__ != "__main__": print("why are you importing the orca command-line tool as a Python module, you absolute goofball") exit(1) +if sys.version_info.major < MAJOR or sys.version_info.minor < MINOR: + print("Your Python version is too old.") + print("Orca requires version {}.{}, but you have version {}.{}.".format(MAJOR, MINOR, sys.version_info.major, sys.version_info.minor)) + exit(1) + # If you modify this, be sure to modify the version in scripts/dev.py as well. def check_if_source(): diff --git a/orca.bat b/orca.bat index 99adab7..7a9e437 100644 --- a/orca.bat +++ b/orca.bat @@ -3,5 +3,5 @@ rem Get the directory of this batch script set "script_dir=%~dp0" -python3 "%script_dir%orca" %* +python "%script_dir%orca" %* exit /b %errorlevel%