500e1268ceddfe67674ae2a3b741f1ea199046c0,src/python/pants/backend/python/goals/run_python_binary.py,,create_python_binary_run_request,#Any#Any#Any#,32
Before Change
// TODO: This is overkill? We don"t need to hydrate the sources and strip snapshots,
// we only need the path relative to the source root.
binary_sources = await Get(HydratedSources, HydrateSourcesRequest(field_set.sources))
stripped_binary_sources = await Get (
StrippedSourceFiles, SourceFiles(binary_sources.snapshot, ())
)
entry_point = PythonBinarySources.translate_source_file_to_entry_point(
stripped_binary_sources.snapshot.files
)
if entry_point is None:
raise InvalidFieldException(
"You must either specify `sources` or `entry_point` for the target "
f"{repr(field_set.address)} in order to run it, but both fields were undefined."
After Change
binary_source_paths = await Get(
Paths, PathGlobs, field_set.sources.path_globs(FilesNotFoundBehavior.error)
)
if len(binary_source_paths.files) != 1:
raise InvalidFieldException(
"No `entry_point` was set for the target "
f"{repr(field_set.address)}, so it must have exactly one source, but it has "
f"{len(binary_source_paths.files)}"
)
entry_point_path = binary_source_paths.files[0]
source_root = await Get(
SourceRoot,
SourceRootRequest,
SourceRootRequest.for_file(entry_point_path),
)
entry_point = PythonBinarySources.translate_source_file_to_entry_point(
os.path.relpath(entry_point_path, source_root.path)
)
transitive_targets = await Get(TransitiveTargets, Addresses([field_set.address]))
// Note that we get an intermediate PexRequest here (instead of going straight to a Pex)
// so that we can get the interpreter constraints for use in runner_pex_request.
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 16
Instances Project Name: pantsbuild/pants
Commit Name: 500e1268ceddfe67674ae2a3b741f1ea199046c0
Time: 2020-09-21
Author: benjyw@gmail.com
File Name: src/python/pants/backend/python/goals/run_python_binary.py
Class Name:
Method Name: create_python_binary_run_request
Project Name: pantsbuild/pants
Commit Name: 500e1268ceddfe67674ae2a3b741f1ea199046c0
Time: 2020-09-21
Author: benjyw@gmail.com
File Name: src/python/pants/backend/python/goals/create_python_binary.py
Class Name:
Method Name: create_python_binary
Project Name: pantsbuild/pants
Commit Name: a6e07cefbde47684bcc540c9f187d3c88311921b
Time: 2020-10-22
Author: 14852634+Eric-Arellano@users.noreply.github.com
File Name: src/python/pants/backend/python/goals/run_pex_binary.py
Class Name:
Method Name: create_pex_binary_run_request
Project Name: pantsbuild/pants
Commit Name: 500e1268ceddfe67674ae2a3b741f1ea199046c0
Time: 2020-09-21
Author: benjyw@gmail.com
File Name: src/python/pants/backend/python/goals/run_python_binary.py
Class Name:
Method Name: create_python_binary_run_request