Skip to content

Commit 23eb5dc

Browse files
committed
Update robotpy-hal to semiwrap
1 parent 3dc1c55 commit 23eb5dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+115
-140
lines changed

subprojects/robotpy-hal/.gitignore

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88
.vscode
99

1010
__pycache__
11-
/hal/include
12-
/hal/lib
13-
/hal/rpy-include
14-
/hal/_init_wpiHal.py
15-
/hal/py.typed
16-
/hal/pkgcfg.py
11+
/hal/trampolines
12+
/hal/_init__wpiHal.py
1713
/hal/version.py
18-
/hal/simulation/_init_simulation.py
19-
/hal/simulation/pkgcfg.py
14+
/hal/wpihal.pc
15+
/hal/simulation/_init__simulation.py
16+
/hal/simulation/hal_simulation.pc
17+
/hal/simulation/trampolines
2018

2119
/dist
2220
/build

subprojects/robotpy-hal/hal/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from . import _initialize
55
from .exceptions import HALError
66

7-
from . import _init_wpiHal
7+
from . import _init__wpiHal
88
from ._wpiHal import *
99

1010
from ._wpiHal import __hal_simulation__
1111

12-
del _init_wpiHal
12+
del _init__wpiHal

subprojects/robotpy-hal/hal/_initialize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from . import exceptions, _init_wpiHal, _wpiHal
1+
from . import exceptions, _init__wpiHal, _wpiHal
22

33
# Always initialize HAL here, disable extension notice because we'll handle
44
# that for users

subprojects/robotpy-hal/hal/py.typed

Whitespace-only changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from . import _init_simulation
1+
from . import _init__simulation
22
from ._simulation import *
33

4-
del _init_simulation
4+
del _init__simulation

subprojects/robotpy-hal/hal/simulation/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

2-
#include <rpygen_wrapper.hpp>
2+
#include <semiwrap_init.hal.simulation._simulation.hpp>
33
#include <pybind11/functional.h>
44

55
#include "sim_cb.h"
66
#include "sim_value_cb.h"
77

88
void HALSIM_ResetGlobalHandles();
99

10-
RPYBUILD_PYBIND11_MODULE(m) {
10+
SEMIWRAP_PYBIND11_MODULE(m) {
1111

1212
py::class_<SimCB> cls_SimCB(m, "SimCB");
1313
cls_SimCB.doc() = "Simulation callback handle";

subprojects/robotpy-hal/hal/src/hal.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
#include <hal/HALBase.h>
44
#include <hal/DriverStation.h>
55
#include <hal/Value.h>
6-
#include <rpygen_wrapper.hpp>
6+
#include <semiwrap_init.hal._wpiHal.hpp>
77

88
using namespace pybind11::literals;
99

1010
static py::module_ sys_module;
1111

12-
RPYBUILD_PYBIND11_MODULE(m) {
12+
SEMIWRAP_PYBIND11_MODULE(m) {
1313

1414
// Add this manually so it can be used from SimValue
1515
py::enum_<HAL_Type>(m, "Type")

subprojects/robotpy-hal/meson.build

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
project('robotpy-hal', ['cpp'],
2+
default_options: ['warning_level=1', 'cpp_std=c++20',
3+
'b_colorout=auto', 'optimization=2', 'b_pie=true'])
4+
5+
subdir('semiwrap')
6+
7+
wpihal_sources += files(
8+
'hal/src/hal.cpp',
9+
)
10+
11+
hal_simulation_sources += files(
12+
'hal/simulation/main.cpp',
13+
'hal/simulation/resethandles.cpp',
14+
)
15+
16+
subdir('semiwrap/modules')

subprojects/robotpy-hal/pyproject.toml

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,49 @@
1-
[tool.robotpy-build.metadata]
1+
[build-system]
2+
build-backend = "hatchling.build"
3+
requires = [
4+
"semiwrap~=0.1",
5+
"hatch-meson~=0.1.0b2",
6+
"hatchling",
7+
"robotpy-native-wpihal==2025.3.2",
8+
"robotpy-wpiutil==2025.3.2.2",
9+
]
10+
11+
[project]
212
name = "robotpy-hal"
13+
version = "2025.3.2.2"
314
description = "Binary wrapper for FRC HAL"
4-
author = "RobotPy Development Team"
5-
author_email = "[email protected]"
6-
url = "https://github.com/robotpy/robotpy-hal"
15+
authors = [
16+
{name = "RobotPy Development Team", email = "[email protected]"},
17+
]
718
license = "BSD-3-Clause"
8-
install_requires = [
9-
"robotpy-wpiutil==THIS_VERSION",
19+
dependencies = [
20+
"robotpy-native-wpihal==2025.3.2",
21+
"robotpy-wpiutil==2025.3.2.2",
1022
]
1123

12-
[build-system]
13-
requires = [
14-
"robotpy-build~=2025.1.0",
15-
"robotpy-wpiutil~=2025.3.2",
16-
]
24+
[project.urls]
25+
"Source code" = "https://github.com/robotpy/mostrobotpy"
26+
27+
28+
[tool.hatch.build.hooks.robotpy]
29+
version_file = "hal/version.py"
30+
31+
[tool.hatch.build.hooks.semiwrap]
32+
33+
[tool.hatch.build.hooks.meson]
1734

18-
[tool.robotpy-build]
19-
base_package = "hal"
35+
[tool.hatch.build.targets.wheel]
36+
packages = ["hal"]
37+
38+
39+
[tool.semiwrap]
40+
update_init = []
2041
scan_headers_ignore = [
2142
"hal/ChipObject.h",
2243
"hal/DMA.h",
2344
"hal/Errors.h",
2445
"hal/HAL.h",
46+
"hal/UsageReporting.h",
2547
"hal/Types.h",
2648
"hal/Value.h",
2749

@@ -45,29 +67,17 @@ scan_headers_ignore = [
4567
"hal/simulation/SPIData.h",
4668
"hal/simulation/SimCallbackRegistry.h",
4769
"hal/simulation/SimDataValue.h",
48-
]
49-
50-
51-
[tool.robotpy-build.wrappers."hal".maven_lib_download]
52-
artifact_id = "hal-cpp"
53-
group_id = "edu.wpi.first.hal"
54-
# repo_url = "https://frcmaven.wpi.edu/artifactory/release"
55-
repo_url = "https://frcmaven.wpi.edu/artifactory/release"
56-
version = "2025.3.2"
57-
58-
libs = ["wpiHal"]
5970

60-
[tool.robotpy-build.wrappers."hal"]
61-
62-
name = "wpiHal"
63-
sources = [
64-
"hal/src/hal.cpp"
71+
"sim_cb.h",
72+
"sim_value_cb.h",
6573
]
6674

67-
generation_data = "gen"
75+
[tool.semiwrap.extension_modules."hal._wpiHal"]
76+
name = "wpihal"
77+
wraps = ["robotpy-native-wpihal"]
6878
depends = ["wpiutil"]
6979

70-
[tool.robotpy-build.wrappers."hal".autogen_headers]
80+
[tool.semiwrap.extension_modules."hal._wpiHal".headers]
7181
# hal
7282
Accelerometer = "hal/Accelerometer.h"
7383
AddressableLED = "hal/AddressableLED.h"
@@ -116,7 +126,7 @@ Threads = "hal/Threads.h"
116126
# Value = "hal/Value.h"
117127

118128
# hal/cpp
119-
# SerialHelper = "hal/cpp/SerialHelper.h"
129+
SerialHelper = { header="hal/cpp/SerialHelper.h", enable_if="platform_machine == 'roborio'" }
120130
# UnsafeDIO = "hal/cpp/UnsafeDIO.h"
121131
# fpga_clock = "hal/cpp/fpga_clock.h"
122132

@@ -133,23 +143,14 @@ HandlesInternal = "hal/handles/HandlesInternal.h"
133143
# HMB = "hal/roborio/HMB.h"
134144
# InterruptManager = "hal/roborio/InterruptManager.h"
135145

136-
[tool.robotpy-build.wrappers."hal".autogen_headers.override.platform_linux_athena]
137-
SerialHelper = "hal/cpp/SerialHelper.h"
138-
139-
140-
[tool.robotpy-build.wrappers."hal.simulation"]
141146

147+
[tool.semiwrap.extension_modules."hal.simulation._simulation"]
142148
name = "hal_simulation"
143-
extension = "_simulation"
144-
sources = [
145-
"hal/simulation/main.cpp",
146-
"hal/simulation/resethandles.cpp",
147-
]
148-
149-
generation_data = "gen/simulation"
150-
depends = ["wpiutil", "wpiHal"]
149+
wraps = ["robotpy-native-wpihal"]
150+
depends = ["wpiutil"]
151+
yaml_path = "semiwrap/simulation"
151152

152-
[tool.robotpy-build.wrappers."hal.simulation".autogen_headers]
153+
[tool.semiwrap.extension_modules."hal.simulation._simulation".headers]
153154
AccelerometerData = "hal/simulation/AccelerometerData.h"
154155
AddressableLEDData = "hal/simulation/AddressableLEDData.h"
155156
AnalogGyroData = "hal/simulation/AnalogGyroData.h"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/meson.build
2+
/modules/meson.build
3+
/trampolines/meson.build

0 commit comments

Comments
 (0)