From 361fe32d5930db340ea78fe05aedfe706f6c9405 Mon Sep 17 00:00:00 2001 From: Lior Goldberg Date: Mon, 29 May 2023 10:40:53 +0300 Subject: [PATCH] Cairo v0.11.2. --- WORKSPACE | 12 +++++------ src/starkware/cairo/lang/VERSION | 2 +- .../cairo/lang/create_cairo_lang_zip.py | 2 +- src/starkware/cairo/vars.bzl | 2 +- src/starkware/python/utils.py | 20 +++++++++++++++++++ ...-rc => BUILD.cairo-compiler-archive-1.1.0} | 2 +- src/starkware/starknet/compiler/v1/compile.py | 2 +- 7 files changed, 31 insertions(+), 11 deletions(-) rename src/starkware/starknet/compiler/v1/{BUILD.cairo-compiler-archive-1.1.0-rc => BUILD.cairo-compiler-archive-1.1.0} (74%) diff --git a/WORKSPACE b/WORKSPACE index 517369af..24712780 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -40,20 +40,20 @@ http_archive( ) http_archive( - name = "cairo-compiler-archive-1.1.0-rc", + name = "cairo-compiler-archive-1.1.0", build_file = get_from_cairo_lang( - "//src/starkware/starknet/compiler/v1:BUILD.cairo-compiler-archive-1.1.0-rc", + "//src/starkware/starknet/compiler/v1:BUILD.cairo-compiler-archive-1.1.0", ), strip_prefix = "cairo", - url = "https://github.com/starkware-libs/cairo/releases/download/v1.1.0-rc0/release-x86_64-unknown-linux-musl.tar.gz", + url = "https://github.com/starkware-libs/cairo/releases/download/v1.1.0/release-x86_64-unknown-linux-musl.tar.gz", ) http_archive( name = "pypy3.9", build_file = "//:pypy3.9_archive_build_file.bzl", - sha256 = "46818cb3d74b96b34787548343d266e2562b531ddbaf330383ba930ff1930ed5", - strip_prefix = "pypy3.9-v7.3.9-linux64", - url = "https://downloads.python.org/pypy/pypy3.9-v7.3.9-linux64.tar.bz2", + sha256 = "d506172ca11071274175d74e9c581c3166432d0179b036470e3b9e8d20eae581", + strip_prefix = "pypy3.9-v7.3.11-linux64", + url = "https://downloads.python.org/pypy/pypy3.9-v7.3.11-linux64.tar.bz2", ) register_toolchains("//bazel_utils/python:py_stub_toolchain") diff --git a/src/starkware/cairo/lang/VERSION b/src/starkware/cairo/lang/VERSION index 90ecd16f..bc859cbd 100644 --- a/src/starkware/cairo/lang/VERSION +++ b/src/starkware/cairo/lang/VERSION @@ -1 +1 @@ -0.11.2a0 +0.11.2 diff --git a/src/starkware/cairo/lang/create_cairo_lang_zip.py b/src/starkware/cairo/lang/create_cairo_lang_zip.py index 966416aa..07d72ae2 100644 --- a/src/starkware/cairo/lang/create_cairo_lang_zip.py +++ b/src/starkware/cairo/lang/create_cairo_lang_zip.py @@ -10,7 +10,7 @@ from starkware.python.utils import get_build_dir_path -COMPILER_DIR = get_build_dir_path("../cairo-compiler-archive-1.1.0-rc") +COMPILER_DIR = get_build_dir_path("../cairo-compiler-archive-1.1.0") INIT_FILE_CONTENT = "__path__ = __import__('pkgutil').extend_path(__path__, __name__)\n" diff --git a/src/starkware/cairo/vars.bzl b/src/starkware/cairo/vars.bzl index b0a13a7a..5007cfd6 100644 --- a/src/starkware/cairo/vars.bzl +++ b/src/starkware/cairo/vars.bzl @@ -3,4 +3,4 @@ CAIRO_VM_CRYPTO_ADDITIONAL_LIBS = [] CAIRO_COMMON_LIB_ADDITIONAL_FILES = [] CAIRO_COMMON_LIB_ADDITIONAL_LIBS = [] CAIRO_INSTANCES_LIB_ADDITIONAL_FILES = [] -CAIRO_COMPILER_ARCHIVE = "cairo-compiler-archive-1.1.0-rc" +CAIRO_COMPILER_ARCHIVE = "cairo-compiler-archive-1.1.0" diff --git a/src/starkware/python/utils.py b/src/starkware/python/utils.py index 13fe3449..b19b1711 100644 --- a/src/starkware/python/utils.py +++ b/src/starkware/python/utils.py @@ -168,6 +168,26 @@ def get_source_dir_path(rel_path: str = "", default_value: Optional[str] = None) raise Exception(f"Failed to get source path for {rel_path}.") +def deduce_absolute_path(path: str) -> str: + """ + Returns the given path if it is absolute, and otherwise joins it with the current working + directory. + This function is useful when using Bazel, which changes the current working directory. + + Important note: This function assumes that the code is being run using Bazel. + """ + + if os.path.isabs(path): + return path + + # The path is considered to be relative to the current working directory. + build_working_directory = os.getenv("BUILD_WORKING_DIRECTORY") + assert ( + build_working_directory is not None + ), "Could not deduce your working directory path; please run your code using Bazel." + return os.path.join(build_working_directory, path) + + def assert_same_and_get(*args): """ Verifies that all the arguments are the same, and returns this value. diff --git a/src/starkware/starknet/compiler/v1/BUILD.cairo-compiler-archive-1.1.0-rc b/src/starkware/starknet/compiler/v1/BUILD.cairo-compiler-archive-1.1.0 similarity index 74% rename from src/starkware/starknet/compiler/v1/BUILD.cairo-compiler-archive-1.1.0-rc rename to src/starkware/starknet/compiler/v1/BUILD.cairo-compiler-archive-1.1.0 index 36b400c4..53c65946 100644 --- a/src/starkware/starknet/compiler/v1/BUILD.cairo-compiler-archive-1.1.0-rc +++ b/src/starkware/starknet/compiler/v1/BUILD.cairo-compiler-archive-1.1.0 @@ -1,7 +1,7 @@ package(default_visibility = ["//visibility:public"]) filegroup( - name = "cairo-compiler-archive-1.1.0-rc", + name = "cairo-compiler-archive-1.1.0", srcs = glob(["**/*"]), visibility = ["//visibility:public"], ) diff --git a/src/starkware/starknet/compiler/v1/compile.py b/src/starkware/starknet/compiler/v1/compile.py index b4a3a73b..629c2f84 100644 --- a/src/starkware/starknet/compiler/v1/compile.py +++ b/src/starkware/starknet/compiler/v1/compile.py @@ -14,7 +14,7 @@ r = runfiles.Create() - COMPILER_DIR = r.Rlocation("cairo-compiler-archive-1.1.0-rc/bin") + COMPILER_DIR = r.Rlocation("cairo-compiler-archive-1.1.0/bin") else: COMPILER_DIR = os.path.join(os.path.dirname(__file__), "bin")