mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
[robotpy] Build examples (#8629)
This hooks up the bazel build to the robotpyExamples. It can use the (formly pyfrc or whatever) automatic unit tests for an example, as well as exposing the ability to run the example in simulation, with or without `halsim_gui` with a command such as `bazel run //robotpyExamples:AddressableLED-sim` This required building and using wheels instead of just a normal `py_library`, so that things like `ENTRY_POINTS` can be used. I took a bare bones approach to building and naming the wheels (for example the native ones don't have the OS info or python version in them, so they wouldn't be suitable publish to pypi, but that can always be updated later.
This commit is contained in:
@@ -417,6 +417,19 @@ def generate_pybind_build_file(
|
||||
except:
|
||||
version_file = None
|
||||
|
||||
# The entry points defined above are implicit to how the project is broken down in the toml files.
|
||||
# This addes potentially extra explicitly declared entry points
|
||||
if "entry-points" in raw_config["project"]:
|
||||
explicit_entry_points = raw_config["project"]["entry-points"]
|
||||
for entry_point_type in explicit_entry_points:
|
||||
for ep_key, ep_value in explicit_entry_points[entry_point_type].items():
|
||||
entry_points[entry_point_type].append(f"{ep_key} = {ep_value}")
|
||||
|
||||
strip_path_prefixes = [
|
||||
f"{fixup_root_package_name(top_level_name)}/{stripped_include_prefix}",
|
||||
f"{fixup_root_package_name(top_level_name)}",
|
||||
]
|
||||
|
||||
with open(output_file, "w") as f:
|
||||
f.write(
|
||||
template.render(
|
||||
@@ -426,6 +439,7 @@ def generate_pybind_build_file(
|
||||
python_deps=sorted(python_deps),
|
||||
all_local_native_deps=all_local_native_deps,
|
||||
stripped_include_prefix=stripped_include_prefix,
|
||||
strip_path_prefixes=strip_path_prefixes,
|
||||
yml_prefix=yml_prefix,
|
||||
package_root_file=package_root_file,
|
||||
raw_project_config=raw_config["project"],
|
||||
|
||||
Reference in New Issue
Block a user