rattler-build icon indicating copy to clipboard operation
rattler-build copied to clipboard

patches with if cause problems

Open pavelzw opened this issue 1 year ago • 2 comments

source:
  - if: polars_variant == 'polars'
    then:
      url: https://pypi.org/packages/source/p/polars/${{ polars_variant | replace('-', '_') }}-${{ version }}.tar.gz
      sha256: 5a3dac3cb7cbe174d1fa898cba9afbede0c08e8728feeeab515554d762127019
      patches:
        if: target_platform == 'win-64'
        then: 0001-Patch-libz-ng-sys.patch
  - if: polars_variant == 'polars-lts-cpu'
    then:
      url: https://pypi.org/packages/source/p/${{ polars_variant }}/${{ polars_variant | replace('-', '_') }}-${{ version }}.tar.gz
      sha256: d2717d17cd764223ea01e35ada2e3235327bc08040ecd41c71c803c7aad874fb
      patches:
        if: target_platform == 'win-64'
        then: 0001-Patch-libz-ng-sys.patch
  - if: polars_variant == 'polars-u64-idx'
    then: 
      url: https://pypi.org/packages/source/p/${{ polars_variant }}/${{ polars_variant | replace('-', '_') }}-${{ version }}.tar.gz
      sha256: 5b47e993d3a73e40f674bc856dbac0e93eaf26c10bc7b1d6768f71faa6e023fe
      patches:
        if: target_platform == 'win-64'
        then: 0001-Patch-libz-ng-sys.patch

context:
  polars_variant: polars
  version: '1.17.1'

package:
  name: ${{ polars_variant }}
  version: ${{ version }}
❯ rattler-build build -r .
Error: 
  × Failed to parse recipe

Error: 
  × Parsing: an unspecified error occurred.
   ╭─[7:11]
 6 │           patches:
 7 │ ╭─▶         if: target_platform == 'win-64'
 8 │ ├─▶         then: 0001-Patch-libz-ng-sys.patch
   · ╰──── expected scalar or sequence for patches
 9 │       - if: polars_variant == 'polars-lts-cpu'
   ╰────

the yml schema doesn't complain so this is either an issue in rattler-build or in the schema.

pavelzw avatar Jan 17 '25 09:01 pavelzw

Can you make it a list and try again?

wolfv avatar Jan 17 '25 09:01 wolfv

yes making it a list fixes it. the yaml-schema doesn't complain, though.

pavelzw avatar Jan 17 '25 10:01 pavelzw

For me, this is a schema issue as the patches should be a list of strings. @zelosleone you can take a look at this in the https://github.com/prefix-dev/recipe-format

wolfv avatar May 12 '25 08:05 wolfv

Schema was updated :)

wolfv avatar May 13 '25 15:05 wolfv