Skip to content

Commit

Permalink
Use posix paths where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed May 14, 2024
1 parent 62994b6 commit cb510f2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/unit/cli/vyper_compile/test_compile_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,4 +424,4 @@ def test_archive_search_path(tmp_path_factory, make_file, chdir_tmp_path):
output_bundle = OutputBundle(compiler_data)

used_dir = search_paths[-1].stem # either dir1 or dir2
assert output_bundle.used_search_paths == [".", "0/" + used_dir]
assert output_bundle.used_search_paths == [".", str(Path("0", used_dir))]
4 changes: 2 additions & 2 deletions vyper/cli/vyper_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def get_output_formats(input_dict: dict) -> dict[PurePath, list[str]]:
output_paths = [PurePath(path) for path in input_dict["sources"].keys()]
else:
output_paths = [PurePath(path)]
if str(output_paths[0]) not in input_dict["sources"]:
if output_paths[0].as_posix() not in input_dict["sources"]:
raise JSONError(f"outputSelection references unknown contract '{output_paths[0]}'")

for output_path in output_paths:
Expand Down Expand Up @@ -317,7 +317,7 @@ def compile_from_input_dict(
def format_to_output_dict(compiler_data: dict) -> dict:
output_dict: dict = {"compiler": f"vyper-{vyper.__version__}", "contracts": {}, "sources": {}}
for path, data in compiler_data.items():
path = str(path) # Path breaks json serializability
path = path.as_posix()
output_dict["sources"][path] = {"id": data["source_id"]}

for k in ("ast_dict", "annotated_ast_dict"):
Expand Down

0 comments on commit cb510f2

Please sign in to comment.