Skip to content

Commit b878ecc

Browse files
authored
Merge pull request #78 from robotpy/semiwrap
Migrate to semiwrap
2 parents e773fc9 + 1077377 commit b878ecc

File tree

70 files changed

+167
-198
lines changed

Some content is hidden

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

70 files changed

+167
-198
lines changed

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ __pycache__
99
*.egg-info
1010
build
1111
dist
12+
/lib
1213

1314
/rev/version.py
14-
/rev/_init_rev.py
15-
/rev/rpy-include
16-
/rev/pkgcfg.py
17-
/rev/py.typed
15+
/rev/_init__rev.py
16+
/rev/trampolines
17+
/rev/*.pc
1818

1919
*.dylib
2020
*.dll

gen/CANDeviceScanner.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

meson.build

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
project('robotpy-rev', ['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+
rev_sources += files(
8+
'rev/rev.cpp',
9+
)
10+
11+
#
12+
# Static link
13+
#
14+
15+
cpp = meson.get_compiler('cpp')
16+
libs_path = meson.current_source_dir() + '/lib/lib'
17+
18+
rev_deps += [
19+
cpp.find_library('REVLibDriver', dirs: libs_path),
20+
cpp.find_library('REVLib', dirs: libs_path),
21+
]
22+
23+
subdir('semiwrap/modules')

pyproject.toml

Lines changed: 64 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,88 @@
1-
[tool.robotpy-build.metadata]
1+
[build-system]
2+
build-backend = "hatchling.build"
3+
requires = [
4+
"hatchling",
5+
"hatch-vcs",
6+
"semiwrap~=0.1",
7+
"hatch-meson~=0.1.0b2",
8+
"hatch-robotpy~=0.2.0",
9+
"wpilib~=2025.3.2.2",
10+
]
11+
12+
13+
[project]
214
name = "robotpy-rev"
15+
dynamic = ["version"]
316
description = "REVLib for RobotPy"
4-
author = "RobotPy Development Team"
5-
author_email = "robotpy@googlegroups.com"
6-
url = "https://github.com/robotpy/robotpy-rev"
717
license = "BSD-3-Clause"
8-
install_requires = [
9-
"wpilib<2026.0.0,>=2025.3.2",
18+
dependencies = [
19+
"wpilib~=2025.3.2.2",
1020
]
1121

12-
[build-system]
13-
requires = [
14-
"robotpy-build<2026.0.0,~=2025.1.0",
15-
"wpilib<2026.0.0,>=2025.3.2",
16-
]
22+
[[project.authors]]
23+
name = "RobotPy Development Team"
24+
email = "robotpy@googlegroups.com"
1725

18-
[tool.robotpy-build]
19-
base_package = "rev"
20-
update_init = ["rev"]
26+
[project.urls]
27+
"Source code" = "https://github.com/robotpy/robotpy-ctre"
2128

22-
[tool.robotpy-build.static_libs."revlib_driver".maven_lib_download]
23-
artifact_id = "REVLib-driver"
29+
30+
[tool.hatch.version]
31+
source = "vcs"
32+
33+
[tool.hatch.build.hooks.vcs]
34+
version-file = "rev/version.py"
35+
36+
[tool.hatch.build.targets.wheel]
37+
packages = ["rev"]
38+
39+
#
40+
# Autogenerated TOML via `python3 -m hatch_robotpy.from_vendor`
41+
#
42+
43+
[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
44+
artifact_id = "REVLib-cpp"
2445
group_id = "com.revrobotics.frc"
2546
repo_url = "https://maven.revrobotics.com"
2647
version = "2025.0.3"
27-
libs = ["REVLibDriver"]
48+
staticlibs = ["REVLib"]
49+
extract_to = "lib"
2850

29-
[tool.robotpy-build.static_libs."revlib".maven_lib_download]
30-
artifact_id = "REVLib-cpp"
51+
[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
52+
artifact_id = "REVLib-driver"
3153
group_id = "com.revrobotics.frc"
3254
repo_url = "https://maven.revrobotics.com"
3355
version = "2025.0.3"
34-
libs = ["REVLib"]
56+
staticlibs = [ "REVLibDriver"]
57+
extract_to = "lib"
58+
59+
#
60+
# End autogenerated TOML
61+
#
62+
63+
64+
[tool.hatch.build.hooks.semiwrap]
65+
66+
[tool.hatch.build.hooks.meson]
3567

36-
[tool.robotpy-build.wrappers."rev"]
68+
69+
70+
[tool.semiwrap]
71+
update_init = ["rev"]
72+
73+
74+
[tool.semiwrap.extension_modules."rev._rev"]
3775
name = "rev"
38-
sources = [
39-
"rev/rev.cpp"
40-
]
4176

4277
depends = [
43-
"wpilibc",
44-
"wpilib_core",
45-
"wpimath_cpp",
46-
"wpiHal",
47-
"wpiutil",
48-
"revlib_driver",
49-
"revlib",
78+
"wpilib",
5079
]
5180

52-
generation_data = "gen"
81+
includes = [
82+
"lib/include"
83+
]
5384

54-
[tool.robotpy-build.wrappers."rev".autogen_headers]
85+
[tool.semiwrap.extension_modules."rev._rev".headers]
5586
# rev
5687
# CANSparkDriver = "rev/CANSparkDriver.h"
5788
# CANSparkDriverPrivate = "rev/CANSparkDriverPrivate.h"

rev/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from .version import __version__
22

3-
from . import _init_rev
3+
from . import _init__rev
44

5-
# autogenerated by 'robotpy-build create-imports rev rev._rev'
5+
# autogenerated by 'semiwrap create-imports rev rev._rev'
66
from ._rev import (
77
AbsoluteEncoder,
88
AbsoluteEncoderConfig,

rev/py.typed

Whitespace-only changes.

rev/rev.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#include <rpygen_wrapper.hpp>
1+
#include <semiwrap_init.rev._rev.hpp>
22

3-
RPYBUILD_PYBIND11_MODULE(m) { initWrapper(m); }
3+
SEMIWRAP_PYBIND11_MODULE(m) { initWrapper(m); }

semiwrap/.gitignore

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
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
AbsoluteEncoder:
3+
rev::AbsoluteEncoder:
54
methods:
65
GetPosition:
76
GetVelocity:

gen/AbsoluteEncoderConfig.yml renamed to semiwrap/AbsoluteEncoderConfig.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
AbsoluteEncoderConfig:
3+
rev::spark::AbsoluteEncoderConfig:
54
base_qualnames:
65
BaseConfig: rev::BaseConfig
76
methods:

gen/AbsoluteEncoderConfigAccessor.yml renamed to semiwrap/AbsoluteEncoderConfigAccessor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
AbsoluteEncoderConfigAccessor:
3+
rev::spark::AbsoluteEncoderConfigAccessor:
54
methods:
65
GetInverted:
76
GetPositionConversionFactor:

gen/AlternateEncoderConfig.yml renamed to semiwrap/AlternateEncoderConfig.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
AlternateEncoderConfig:
3+
rev::spark::AlternateEncoderConfig:
54
base_qualnames:
65
BaseConfig: rev::BaseConfig
76
enums:

gen/AlternateEncoderConfigAccessor.yml renamed to semiwrap/AlternateEncoderConfigAccessor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
AlternateEncoderConfigAccessor:
3+
rev::spark::AlternateEncoderConfigAccessor:
54
methods:
65
GetCountsPerRevolution:
76
GetInverted:
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
AnalogInput:
3+
rev::AnalogInput:
54
methods:
65
GetVoltage:
76
GetPosition:

gen/AnalogSensorConfig.yml renamed to semiwrap/AnalogSensorConfig.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
AnalogSensorConfig:
3+
rev::spark::AnalogSensorConfig:
54
base_qualnames:
65
BaseConfig: rev::BaseConfig
76
methods:

gen/AnalogSensorConfigAccessor.yml renamed to semiwrap/AnalogSensorConfigAccessor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
AnalogSensorConfigAccessor:
3+
rev::spark::AnalogSensorConfigAccessor:
54
methods:
65
GetInverted:
76
GetPositionConversionFactor:

gen/BaseConfig.yml renamed to semiwrap/BaseConfig.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
BaseConfig:
3+
rev::BaseConfig:
54
methods:
65
Flatten:
76
BaseConfig:

gen/CIEColor.yml renamed to semiwrap/CIEColor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
CIEColor:
3+
rev::CIEColor:
54
methods:
65
CIEColor:
76
GetX:

gen/ClosedLoopConfig.yml renamed to semiwrap/ClosedLoopConfig.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
ClosedLoopConfig:
3+
rev::spark::ClosedLoopConfig:
54
base_qualnames:
65
BaseConfig: rev::BaseConfig
76
attributes:

gen/ClosedLoopConfigAccessor.yml renamed to semiwrap/ClosedLoopConfigAccessor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
ClosedLoopConfigAccessor:
3+
rev::spark::ClosedLoopConfigAccessor:
54
attributes:
65
maxMotion:
76
smartMotion:
File renamed without changes.

gen/ColorMatch.yml renamed to semiwrap/ColorMatch.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
ColorMatch:
3+
rev::ColorMatch:
54
methods:
65
ColorMatch:
76
AddColorMatch:

gen/ColorSensorV3.yml renamed to semiwrap/ColorSensorV3.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
ColorSensorV3:
3+
rev::ColorSensorV3:
54
enums:
65
GainFactor:
76
LEDPulseFrequency:
@@ -23,7 +22,7 @@ classes:
2322
ConfigureColorSensor:
2423
HasReset:
2524
IsConnected:
26-
ColorSensorV3::RawColor:
25+
rev::ColorSensorV3::RawColor:
2726
attributes:
2827
red:
2928
green:

gen/EncoderConfig.yml renamed to semiwrap/EncoderConfig.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
EncoderConfig:
3+
rev::spark::EncoderConfig:
54
base_qualnames:
65
BaseConfig: rev::BaseConfig
76
methods:

gen/EncoderConfigAccessor.yml renamed to semiwrap/EncoderConfigAccessor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
EncoderConfigAccessor:
3+
rev::spark::EncoderConfigAccessor:
54
methods:
65
GetCountsPerRevolution:
76
GetInverted:

gen/ExternalEncoderConfig.yml renamed to semiwrap/ExternalEncoderConfig.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
ExternalEncoderConfig:
3+
rev::spark::ExternalEncoderConfig:
54
base_qualnames:
65
BaseConfig: rev::BaseConfig
76
enums:

gen/ExternalEncoderConfigAccessor.yml renamed to semiwrap/ExternalEncoderConfigAccessor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
ExternalEncoderConfigAccessor:
3+
rev::spark::ExternalEncoderConfigAccessor:
54
methods:
65
GetCountsPerRevolution:
76
GetInverted:

gen/LimitSwitchConfig.yml renamed to semiwrap/LimitSwitchConfig.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
---
21

32
classes:
4-
LimitSwitchConfig:
3+
rev::spark::LimitSwitchConfig:
54
base_qualnames:
65
BaseConfig: rev::BaseConfig
76
enums:

0 commit comments

Comments
 (0)