Skip to content

Commit

Permalink
Prevent installer from working with RobotPy versions from other years
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald committed Dec 12, 2024
1 parent d86e1c3 commit ccfdb56
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions robotpy_installer/pyproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import tomli
import tomlkit

from . import installer
from . import pypackages
from .pypackages import Packages, Env
from .errors import Error
Expand All @@ -22,6 +23,10 @@ class NoRobotpyError(PyprojectError):
pass


class UnsupportedRobotpyVersion(PyprojectError):
pass


def toml_path(project_path: pathlib.Path):
return project_path / "pyproject.toml"

Expand Down Expand Up @@ -223,6 +228,14 @@ def _load(
f"{pyproject_path}: tools.robotpy.robotpy_version is not a valid version"
) from None

supported_year = int(installer._WPILIB_YEAR)
if robotpy_version.major != supported_year:
msg = (
f"Only RobotPy {supported_year}.x is supported by this version "
f"of robotpy-installer ({pyproject_path} has {robotpy_version})"
)
raise UnsupportedRobotpyVersion(msg)

robotpy_extras_any = robotpy_data.get("robotpy_extras")
if isinstance(robotpy_extras_any, list):
robotpy_extras = list(map(str, robotpy_extras_any))
Expand Down

0 comments on commit ccfdb56

Please sign in to comment.