Skip to content

Commit

Permalink
[python] make sure project-root is used in buck mode
Browse files Browse the repository at this point in the history
Reviewed By: dulmarod

Differential Revision: D68555040

fbshipit-source-id: e2ef220014ed3bd43f67e6c19f8cd1328b975c44
  • Loading branch information
martintrojer authored and facebook-github-bot committed Jan 23, 2025
1 parent 1199bef commit 5745a78
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion infer/src/integration/Python.ml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,14 @@ let dump_textual_file ~version pyc module_ =

let process_file ~is_binary file =
let open IResult.Let_syntax in
let sourcefile = Textual.SourceFile.create file in
let sourcefile =
let file' =
(* if we are in buck-mode, we need to use absolute paths in order for Config.project_root
to be properly applied in SourceFile.create *)
if Config.buck then Utils.filename_to_absolute ~root:Config.buck2_root file else file
in
Textual.SourceFile.create file'
in
let* code = FFI.from_file ~is_binary file |> Result.map_error ~f:Error.ffi in
let* pyir = PyIR.mk ~debug:false code |> Result.map_error ~f:Error.ir in
let textual = PyIR2Textual.mk_module pyir in
Expand Down

0 comments on commit 5745a78

Please sign in to comment.