From d8f78302d0a698ed18c86627cbddaf13a38dbd2b Mon Sep 17 00:00:00 2001 From: Arni Hod Date: Tue, 26 Nov 2024 09:20:23 +0200 Subject: [PATCH] chore(blockifier): use infra utils dir in cairo compile --- Cargo.lock | 1 + crates/blockifier/Cargo.toml | 1 + crates/blockifier/src/test_utils/cairo_compile.rs | 7 +++---- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e934462c589..e71626dcf9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1498,6 +1498,7 @@ dependencies = [ "derive_more 0.99.18", "glob", "indexmap 2.6.0", + "infra_utils", "itertools 0.12.1", "keccak", "log", diff --git a/crates/blockifier/Cargo.toml b/crates/blockifier/Cargo.toml index 7f05e3127db..7532385cec3 100644 --- a/crates/blockifier/Cargo.toml +++ b/crates/blockifier/Cargo.toml @@ -32,6 +32,7 @@ cairo-native = { workspace = true, optional = true } cairo-vm.workspace = true derive_more.workspace = true indexmap.workspace = true +infra_utils.workspace = true itertools.workspace = true keccak.workspace = true log.workspace = true diff --git a/crates/blockifier/src/test_utils/cairo_compile.rs b/crates/blockifier/src/test_utils/cairo_compile.rs index a0c5f77a8d9..4e335239596 100644 --- a/crates/blockifier/src/test_utils/cairo_compile.rs +++ b/crates/blockifier/src/test_utils/cairo_compile.rs @@ -1,9 +1,10 @@ use std::io::Write; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; use std::process::{Command, Output}; use std::{env, fs}; use cached::proc_macro::cached; +use infra_utils::path::cargo_manifest_dir; use serde::{Deserialize, Serialize}; use tempfile::NamedTempFile; @@ -69,9 +70,7 @@ pub fn cairo1_compiler_tag() -> String { /// overridden by the environment variable (otherwise, the default is used). fn local_cairo1_compiler_repo_path() -> PathBuf { // Location of blockifier's Cargo.toml. - let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - - Path::new(&manifest_dir).join( + cargo_manifest_dir().unwrap().join( env::var(CAIRO1_REPO_RELATIVE_PATH_OVERRIDE_ENV_VAR) .unwrap_or_else(|_| DEFAULT_CAIRO1_REPO_RELATIVE_PATH.into()), )