[copybara] mostrobotpy to allwpilib (#8545)

Project import generated by Copybara.
GitOrigin-RevId: f10284b37498bb6a088891ca41f160793ec7fd90
This commit is contained in:
PJ Reiniger
2026-01-12 22:11:02 -05:00
committed by GitHub
parent 7e1260b003
commit 762d1e8b93
64 changed files with 2665 additions and 66 deletions

View File

@@ -382,13 +382,24 @@ def generate_pybind_build_file(
base_library = python_dep.replace("robotpy-", "")
return f"//{fixup_root_package_name(base_library)}:{fixup_python_dep_name(python_dep)}"
EXTERNAL_PYPI_DEPS = [
"robotpy-cli",
"pytest-reraise",
"pytest",
]
python_deps = []
has_external_python_deps = False
if "dependencies" in raw_config["project"]:
for d in raw_config["project"]["dependencies"]:
if "robotpy-cli" in d:
continue
pd = target_from_python_dep(d.split("==")[0])
python_deps.append(pd)
for external_dep in EXTERNAL_PYPI_DEPS:
if external_dep in d:
has_external_python_deps = True
python_deps.append(f'requirement("{external_dep}")')
break
else:
pd = target_from_python_dep(d.split("==")[0])
python_deps.append(pd)
env = Environment(loader=BaseLoader)
env.filters["jsonify"] = jsonify
@@ -420,6 +431,7 @@ def generate_pybind_build_file(
raw_project_config=raw_config["project"],
entry_points=entry_points,
version_file=version_file,
has_external_python_deps=has_external_python_deps,
)
+ "\n"
)

View File

@@ -11,6 +11,8 @@ def fixup_root_package_name(name):
return "romiVendordep"
if name == "pyntcore":
return "ntcore"
if name == "halsim-ws":
return "simulation/halsim_ws_core"
return name

View File

@@ -1,5 +1,8 @@
# THIS FILE IS AUTO GENERATED
{% if publish_casters_targets %}
{% if has_external_python_deps %}
load("@allwpilib_pip_deps//:requirements.bzl", "requirement")
{%- endif %}
{%- if publish_casters_targets %}
load("@rules_cc//cc:cc_library.bzl", "cc_library")
{%- endif %}
{%- if version_file %}
@@ -211,7 +214,7 @@ def define_pybind_library(name, pkgcfgs = []):
imports = ["{{stripped_include_prefix}}"],
deps = [
{%- for d in python_deps %}
"{{d}}",
{% if "requirement" in d %}{{d}}{% else %}"{{d}}"{% endif %},
{%- endfor %}
],
visibility = ["//visibility:public"],

View File

@@ -1,10 +1,10 @@
load("@rules_python_pytest//python_pytest:defs.bzl", "py_pytest_test")
load("//shared/bazel/rules/robotpy:compatibility_select.bzl", "robotpy_compatibility_select")
def robotpy_py_test(name, srcs, tags = [], **kwargs):
def robotpy_py_test(name, srcs, tags = [], size = "small", **kwargs):
py_pytest_test(
name = name,
size = "small",
size = size,
srcs = srcs,
target_compatible_with = robotpy_compatibility_select(),
tags = tags + [