Skip to content
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

fix: constrain feature platforms in schema #2055

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

bollwyvl
Copy link
Contributor

At present, the following does not raise an error when editing/validating:

[feature.foo_bar]
platforms = ["garbage"]

But does raise an issue when parsed:

  × failed to parse project manifest
    ╭─[pixi.toml:10:13]
  9 │ [feature.foo_bar]
 10 │ platforms = ["garbage"]
    ·             ─────┬─────
    ·                  ╰── 'garbage' is not a known platform. Valid platforms are 'noarch', 'unknown', 'linux-32', 'linux-64', 'linux-aarch64', 'linux-armv6l', 'linux-armv7l', 'linux-ppc64le', 'linux-ppc64', 'linux-s390x', 'linux-riscv32', 'linux-riscv64', 'osx-64', 'osx-arm64', 'win-32', 'win-64', 'win-arm64', 'emscripten-wasm32', 'wasi-wasm32', 'zos-z'
    ╰────

This PR:

  • makes an enum out of Platform
    • updates it to the current list reported by the error
    • sorts the list
  • uses Platform in platforms and feature.*.platforms.
  • adds a schema test for bad feature platforms
    • reworks schema example finder to glob over (in)valid/*.toml

Future work (not on this PR):

  • the "true" list of platforms is, of course, whatever the rust code (probably rattler?) thinks it is, but apparently, short of creating an error, there is no way to get this list
    • this could perhaps be added to
      • pixi info --json (which, as with More task JSON #1344, doesn't have a schema) or
      • something like $PIXI_ENVIRONMENT_PLATFORMS (not sure how useful that is outside of this case)

@bollwyvl bollwyvl marked this pull request as ready for review September 16, 2024 14:17
Copy link
Contributor

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Would be best if this was validated to be in sync but I don't know a straight forward way to so now.

@ruben-arts ruben-arts merged commit def0563 into prefix-dev:main Sep 16, 2024
34 checks passed
@bollwyvl bollwyvl deleted the add-feature-platforms-schema branch September 16, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants