Skip to content

Migrate to semiwrap #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ __pycache__
*.egg-info
build
dist
/lib

/rev/version.py
/rev/_init_rev.py
/rev/rpy-include
/rev/pkgcfg.py
/rev/py.typed
/rev/_init__rev.py
/rev/trampolines
/rev/*.pc

*.dylib
*.dll
25 changes: 0 additions & 25 deletions gen/CANDeviceScanner.yml

This file was deleted.

23 changes: 23 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
project('robotpy-rev', ['cpp'],
default_options: ['warning_level=1', 'cpp_std=c++20',
'b_colorout=auto', 'optimization=2', 'b_pie=true'])

subdir('semiwrap')

rev_sources += files(
'rev/rev.cpp',
)

#
# Static link
#

cpp = meson.get_compiler('cpp')
libs_path = meson.current_source_dir() + '/lib/lib'

rev_deps += [
cpp.find_library('REVLibDriver', dirs: libs_path),
cpp.find_library('REVLib', dirs: libs_path),
]

subdir('semiwrap/modules')
97 changes: 64 additions & 33 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,57 +1,88 @@
[tool.robotpy-build.metadata]
[build-system]
build-backend = "hatchling.build"
requires = [
"hatchling",
"hatch-vcs",
"semiwrap~=0.1",
"hatch-meson~=0.1.0b2",
"hatch-robotpy~=0.2.0",
"wpilib~=2025.3.2.2",
]


[project]
name = "robotpy-rev"
dynamic = ["version"]
description = "REVLib for RobotPy"
author = "RobotPy Development Team"
author_email = "robotpy@googlegroups.com"
url = "https://github.com/robotpy/robotpy-rev"
license = "BSD-3-Clause"
install_requires = [
"wpilib<2026.0.0,>=2025.3.2",
dependencies = [
"wpilib~=2025.3.2.2",
]

[build-system]
requires = [
"robotpy-build<2026.0.0,~=2025.1.0",
"wpilib<2026.0.0,>=2025.3.2",
]
[[project.authors]]
name = "RobotPy Development Team"
email = "robotpy@googlegroups.com"

[tool.robotpy-build]
base_package = "rev"
update_init = ["rev"]
[project.urls]
"Source code" = "https://github.com/robotpy/robotpy-ctre"

[tool.robotpy-build.static_libs."revlib_driver".maven_lib_download]
artifact_id = "REVLib-driver"

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "rev/version.py"

[tool.hatch.build.targets.wheel]
packages = ["rev"]

#
# Autogenerated TOML via `python3 -m hatch_robotpy.from_vendor`
#

[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
artifact_id = "REVLib-cpp"
group_id = "com.revrobotics.frc"
repo_url = "https://maven.revrobotics.com"
version = "2025.0.3"
libs = ["REVLibDriver"]
staticlibs = ["REVLib"]
extract_to = "lib"

[tool.robotpy-build.static_libs."revlib".maven_lib_download]
artifact_id = "REVLib-cpp"
[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
artifact_id = "REVLib-driver"
group_id = "com.revrobotics.frc"
repo_url = "https://maven.revrobotics.com"
version = "2025.0.3"
libs = ["REVLib"]
staticlibs = [ "REVLibDriver"]
extract_to = "lib"

#
# End autogenerated TOML
#


[tool.hatch.build.hooks.semiwrap]

[tool.hatch.build.hooks.meson]

[tool.robotpy-build.wrappers."rev"]


[tool.semiwrap]
update_init = ["rev"]


[tool.semiwrap.extension_modules."rev._rev"]
name = "rev"
sources = [
"rev/rev.cpp"
]

depends = [
"wpilibc",
"wpilib_core",
"wpimath_cpp",
"wpiHal",
"wpiutil",
"revlib_driver",
"revlib",
"wpilib",
]

generation_data = "gen"
includes = [
"lib/include"
]

[tool.robotpy-build.wrappers."rev".autogen_headers]
[tool.semiwrap.extension_modules."rev._rev".headers]
# rev
# CANSparkDriver = "rev/CANSparkDriver.h"
# CANSparkDriverPrivate = "rev/CANSparkDriverPrivate.h"
Expand Down
4 changes: 2 additions & 2 deletions rev/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from .version import __version__

from . import _init_rev
from . import _init__rev

# autogenerated by 'robotpy-build create-imports rev rev._rev'
# autogenerated by 'semiwrap create-imports rev rev._rev'
from ._rev import (
AbsoluteEncoder,
AbsoluteEncoderConfig,
Expand Down
Empty file added rev/py.typed
Empty file.
4 changes: 2 additions & 2 deletions rev/rev.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <rpygen_wrapper.hpp>
#include <semiwrap_init.rev._rev.hpp>

RPYBUILD_PYBIND11_MODULE(m) { initWrapper(m); }
SEMIWRAP_PYBIND11_MODULE(m) { initWrapper(m); }
3 changes: 3 additions & 0 deletions semiwrap/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/meson.build
/modules/meson.build
/trampolines/meson.build
3 changes: 1 addition & 2 deletions gen/AbsoluteEncoder.yml → semiwrap/AbsoluteEncoder.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
AbsoluteEncoder:
rev::AbsoluteEncoder:
methods:
GetPosition:
GetVelocity:
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
AbsoluteEncoderConfig:
rev::spark::AbsoluteEncoderConfig:
base_qualnames:
BaseConfig: rev::BaseConfig
methods:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
AbsoluteEncoderConfigAccessor:
rev::spark::AbsoluteEncoderConfigAccessor:
methods:
GetInverted:
GetPositionConversionFactor:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
AlternateEncoderConfig:
rev::spark::AlternateEncoderConfig:
base_qualnames:
BaseConfig: rev::BaseConfig
enums:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
AlternateEncoderConfigAccessor:
rev::spark::AlternateEncoderConfigAccessor:
methods:
GetCountsPerRevolution:
GetInverted:
Expand Down
3 changes: 1 addition & 2 deletions gen/AnalogInput.yml → semiwrap/AnalogInput.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
AnalogInput:
rev::AnalogInput:
methods:
GetVoltage:
GetPosition:
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
AnalogSensorConfig:
rev::spark::AnalogSensorConfig:
base_qualnames:
BaseConfig: rev::BaseConfig
methods:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
AnalogSensorConfigAccessor:
rev::spark::AnalogSensorConfigAccessor:
methods:
GetInverted:
GetPositionConversionFactor:
Expand Down
3 changes: 1 addition & 2 deletions gen/BaseConfig.yml → semiwrap/BaseConfig.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
BaseConfig:
rev::BaseConfig:
methods:
Flatten:
BaseConfig:
Expand Down
3 changes: 1 addition & 2 deletions gen/CIEColor.yml → semiwrap/CIEColor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
CIEColor:
rev::CIEColor:
methods:
CIEColor:
GetX:
Expand Down
3 changes: 1 addition & 2 deletions gen/ClosedLoopConfig.yml → semiwrap/ClosedLoopConfig.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
ClosedLoopConfig:
rev::spark::ClosedLoopConfig:
base_qualnames:
BaseConfig: rev::BaseConfig
attributes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
ClosedLoopConfigAccessor:
rev::spark::ClosedLoopConfigAccessor:
attributes:
maxMotion:
smartMotion:
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions gen/ColorMatch.yml → semiwrap/ColorMatch.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
ColorMatch:
rev::ColorMatch:
methods:
ColorMatch:
AddColorMatch:
Expand Down
5 changes: 2 additions & 3 deletions gen/ColorSensorV3.yml → semiwrap/ColorSensorV3.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
ColorSensorV3:
rev::ColorSensorV3:
enums:
GainFactor:
LEDPulseFrequency:
Expand All @@ -23,7 +22,7 @@ classes:
ConfigureColorSensor:
HasReset:
IsConnected:
ColorSensorV3::RawColor:
rev::ColorSensorV3::RawColor:
attributes:
red:
green:
Expand Down
3 changes: 1 addition & 2 deletions gen/EncoderConfig.yml → semiwrap/EncoderConfig.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
EncoderConfig:
rev::spark::EncoderConfig:
base_qualnames:
BaseConfig: rev::BaseConfig
methods:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
EncoderConfigAccessor:
rev::spark::EncoderConfigAccessor:
methods:
GetCountsPerRevolution:
GetInverted:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
ExternalEncoderConfig:
rev::spark::ExternalEncoderConfig:
base_qualnames:
BaseConfig: rev::BaseConfig
enums:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
ExternalEncoderConfigAccessor:
rev::spark::ExternalEncoderConfigAccessor:
methods:
GetCountsPerRevolution:
GetInverted:
Expand Down
3 changes: 1 addition & 2 deletions gen/LimitSwitchConfig.yml → semiwrap/LimitSwitchConfig.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---

classes:
LimitSwitchConfig:
rev::spark::LimitSwitchConfig:
base_qualnames:
BaseConfig: rev::BaseConfig
enums:
Expand Down
Loading
Loading