[bazel][robotpy] Add mirror for robotpy's wpiuil and wpinet libraries (#8062)

Project import generated by Copybara.

GitOrigin-RevId: 92ea93d1b47a82667044bd0af05f7fdb34d2c2c2
This commit is contained in:
PJ Reiniger
2025-08-30 14:55:11 -04:00
committed by GitHub
parent 96004f9bb5
commit bd1dcc4358
96 changed files with 7271 additions and 64 deletions

View File

@@ -0,0 +1,7 @@
robotpy-wpinet
==============
Python wrappers for WPILib's wpinet library.
* Installation instructions can be found in the [RobotPy documentation](https://robotpy.readthedocs.io/en/latest/getting_started.html)
* Documentation can be found at [readthedocs](https://robotpy.readthedocs.io/projects/wpinet/en/stable/api.html)

View File

@@ -0,0 +1,17 @@
#!/usr/bin/env python3
import argparse
import time
import wpinet
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("port", type=int, help="Local port number")
parser.add_argument("remoteHost", help="Remote IP address / DNS name")
parser.add_argument("remotePort", type=int, help="remote port number")
args = parser.parse_args()
wpinet.PortForwarder.getInstance().add(args.port, args.remoteHost, args.remotePort)
while True:
time.sleep(1)

View File

@@ -0,0 +1,39 @@
[build-system]
build-backend = "hatchling.build"
requires = [
"hatchling",
"hatch-nativelib~=0.2.0",
"hatch-robotpy~=0.2.1",
"robotpy-native-wpiutil==2027.0.0a2",
]
[project]
name = "robotpy-native-wpinet"
version = "2027.0.0a2"
description = "WPILib Networking Library"
license = "BSD-3-Clause"
dependencies = [
"robotpy-native-wpiutil==2027.0.0a2",
]
[tool.hatch.build.targets.wheel]
packages = ["src/native"]
[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
artifact_id = "wpinet-cpp"
group_id = "edu.wpi.first.wpinet"
repo_url = "https://frcmaven.wpi.edu/artifactory/release-2027"
version = "2027.0.0-alpha-2"
extract_to = "src/native/wpinet"
libs = ["wpinet"]
[[tool.hatch.build.hooks.nativelib.pcfile]]
pcfile = "src/native/wpinet/robotpy-native-wpinet.pc"
name = "wpinet"
includedir = "src/native/wpinet/include"
libdir = "src/native/wpinet/lib"
shared_libraries = ["wpinet"]
requires = ["robotpy-native-wpiutil"]

View File

@@ -0,0 +1,54 @@
[build-system]
build-backend = "hatchling.build"
requires = [
"semiwrap~=0.1.7",
"hatch-meson~=0.1.0b2",
"hatchling",
"robotpy-native-wpinet==2027.0.0a2",
"robotpy-wpiutil==2027.0.0a2"
]
[project]
name = "robotpy-wpinet"
version = "2027.0.0a2"
description = "Binary wrapper for FRC wpinet library"
authors = [
{name = "RobotPy Development Team", email = "robotpy@googlegroups.com"},
]
license = "BSD-3-Clause"
dependencies = [
"robotpy-native-wpinet==2027.0.0a2",
"robotpy-wpiutil==2027.0.0a2"
]
[project.urls]
"Source code" = "https://github.com/robotpy/mostrobotpy"
[tool.hatch.build.hooks.robotpy]
version_file = "wpinet/version.py"
[tool.hatch.build.hooks.semiwrap]
[tool.hatch.build.hooks.meson]
[tool.hatch.build.targets.wheel]
packages = ["wpinet"]
[tool.semiwrap]
update_init = [
"wpinet"
]
# we don't wrap anything here
scan_headers_ignore = ["*"]
[tool.semiwrap.extension_modules."wpinet._wpinet"]
name = "wpinet"
wraps = ["robotpy-native-wpinet"]
depends = ["wpiutil"]
[tool.semiwrap.extension_modules."wpinet._wpinet".headers]
# wpinet
PortForwarder = "wpinet/PortForwarder.h"
WebServer = "wpinet/WebServer.h"

View File

@@ -0,0 +1,8 @@
classes:
wpi::PortForwarder:
nodelete: true
methods:
GetInstance:
return_value_policy: reference
Add:
Remove:

View File

@@ -0,0 +1,8 @@
classes:
wpi::WebServer:
nodelete: true
methods:
GetInstance:
return_value_policy: reference
Start:
Stop:

View File

@@ -0,0 +1,7 @@
from . import _init__wpinet
# autogenerated by 'semiwrap create-imports wpinet wpinet._wpinet'
from ._wpinet import PortForwarder, WebServer
__all__ = ["PortForwarder", "WebServer"]

View File

View File

@@ -0,0 +1,4 @@
#include <semiwrap_init.wpinet._wpinet.hpp>
SEMIWRAP_PYBIND11_MODULE(m) { initWrapper(m); }

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env python3
import os
from os.path import abspath, dirname
import sys
import subprocess
if __name__ == "__main__":
root = abspath(dirname(__file__))
os.chdir(root)
subprocess.check_call([sys.executable, "-m", "pytest"])

View File

@@ -0,0 +1,5 @@
import wpinet
def test_existance():
pass