From 77232c5b3301636446925c8dcbb5a0145e162741 Mon Sep 17 00:00:00 2001 From: Itay Tsabary Date: Wed, 4 Dec 2024 14:38:58 +0200 Subject: [PATCH] chore(starknet_api): revert use get_packaget_dir instead of env var This reverts commit c45f5cc0dce72ba5b1779c95e30d7f1a8461958e. commit-id:a48736e7 --- Cargo.lock | 2 +- crates/starknet_api/Cargo.toml | 7 +++++-- crates/starknet_api/src/test_utils.rs | 12 +++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b95f307863..b01906f227 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10226,9 +10226,9 @@ dependencies = [ "derive_more 0.99.18", "hex", "indexmap 2.6.0", + "infra_utils", "itertools 0.12.1", "num-bigint 0.4.6", - "papyrus_proc_macros", "pretty_assertions", "primitive-types", "rstest", diff --git a/crates/starknet_api/Cargo.toml b/crates/starknet_api/Cargo.toml index cb9b0095f2..4fd905b38c 100644 --- a/crates/starknet_api/Cargo.toml +++ b/crates/starknet_api/Cargo.toml @@ -11,14 +11,14 @@ testing = [] [dependencies] bitvec.workspace = true -cairo-lang-runner.workspace = true cairo-lang-starknet-classes.workspace = true +cairo-lang-runner.workspace = true derive_more.workspace = true hex.workspace = true indexmap = { workspace = true, features = ["serde"] } +infra_utils.workspace = true itertools.workspace = true num-bigint.workspace = true -papyrus_proc_macros.workspace = true pretty_assertions.workspace = true primitive-types = { workspace = true, features = ["serde"] } semver.workspace = true @@ -35,5 +35,8 @@ thiserror.workspace = true assert_matches.workspace = true rstest.workspace = true +[package.metadata.cargo-machete] +ignored = ["strum"] + [lints] workspace = true diff --git a/crates/starknet_api/src/test_utils.rs b/crates/starknet_api/src/test_utils.rs index 66a3e9d09b..2addfd0ae3 100644 --- a/crates/starknet_api/src/test_utils.rs +++ b/crates/starknet_api/src/test_utils.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use std::fs::read_to_string; use std::path::{Path, PathBuf}; -use papyrus_proc_macros::generate_get_package_dir; +use infra_utils::path::cargo_manifest_dir; use serde::{Deserialize, Serialize}; use serde_json::to_string_pretty; use starknet_types_core::felt::Felt; @@ -17,13 +17,11 @@ pub mod deploy_account; pub mod invoke; pub mod l1_handler; -generate_get_package_dir!(); - -/// Returns the path to a file in the resources directory. This assumes the package directory has a -/// `resources` folder. The value for file_path should be the path to the required file in the -/// folder "resources". +/// Returns the path to a file in the resources directory. This assumes the current working +/// directory has a `resources` folder. The value for file_path should be the path to the required +/// file in the folder "resources". pub fn path_in_resources>(file_path: P) -> PathBuf { - PathBuf::from(get_package_dir()).join("resources").join(file_path) + cargo_manifest_dir().unwrap().join("resources").join(file_path) } /// Reads from the directory containing the manifest at run time, same as current working directory.