Skip to content

Commit 8b5b0c2

Browse files
committed
gh-152384: pixi-packages: use flags to define variants
1 parent 93454fe commit 8b5b0c2

12 files changed

Lines changed: 19 additions & 97 deletions

File tree

Tools/pixi-packages/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,34 @@ in a [Pixi workspace](https://pixi.sh/latest/first_workspace/), like:
1010
```toml
1111
[dependencies]
1212
python.git = "https://github.com/python/cpython"
13-
python.subdirectory = "Tools/pixi-packages/asan"
13+
python.subdirectory = "Tools/pixi-packages"
14+
python.flags = "asan"
1415
```
1516

1617
This is particularly useful when developers need to build CPython from source
1718
(for example, for an ASan or TSan-instrumented build), as it does not require any manual
1819
clone or build steps. Instead, Pixi will automatically handle both the build
1920
and installation of the package.
2021

21-
Each package definition is contained in a subdirectory, but they share the build script
22-
`build.sh` in this directory. Currently defined package variants:
22+
Each package variant carries a 'flag' to enable selection of that variant — see
23+
[the Pixi docs](https://pixi.prefix.dev/latest/concepts/package_specifications/#extras-and-flags
24+
for details of how to use this. Currently defined package variants:
2325

2426
- `default`
2527
- `freethreading`
2628
- `asan`: ASan-instrumented build
27-
- `tsan-freethreading`: TSan-instrumented free-threading build
29+
- `tsan_freethreading`: TSan-instrumented free-threading build
2830

2931
## Maintenance
3032

31-
- Keep the `abi_tag` and `version` fields in each `variants.yaml` up to date with the
33+
- Keep the `abi_tag` and `version` fields in `variants.yaml` up to date with the
3234
Python version
3335
- Update `build.sh` for any breaking changes in the `configure` and `make` workflow
3436

3537
## Opportunities for future improvement
3638

3739
- More package variants (such as UBSan)
3840
- Support for Windows
39-
- Using a single `pixi.toml` for all package variants is blocked on
40-
[pixi#5248](https://github.com/prefix-dev/pixi/issues/5248)
4141

4242
## Troubleshooting
4343

Tools/pixi-packages/asan/variants.yaml

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

Tools/pixi-packages/clone-recipe.sh

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

Tools/pixi-packages/default/pixi.toml

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

Tools/pixi-packages/default/variants.yaml

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

Tools/pixi-packages/freethreading/pixi.toml

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

Tools/pixi-packages/freethreading/variants.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# NOTE: Please always only modify default/pixi.toml and then run clone-recipe.sh to
2-
# propagate the changes to the other variants.
3-
41
[workspace]
52
channels = ["https://prefix.dev/conda-forge"]
63
platforms = ["linux-64", "linux-aarch64", "osx-64", "osx-arm64"]
@@ -10,6 +7,3 @@ requires-pixi = ">=0.66.0"
107
[package.build.backend]
118
name = "pixi-build-rattler-build"
129
version = "*"
13-
14-
[package.build.config]
15-
recipe = "../default/recipe.yaml"
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# NOTE: Please always only modify default/recipe.yaml and then run clone-recipe.sh to
2-
# propagate the changes to the other variants.
3-
41
context:
52
# Keep up to date
63
freethreading_tag: ${{ "t" if "freethreading" in variant else "" }}
@@ -9,7 +6,7 @@ recipe:
96
name: python
107

118
source:
12-
- path: ../../..
9+
- path: ../..
1310

1411
outputs:
1512
- package:
@@ -25,12 +22,14 @@ outputs:
2522
name: python
2623
version: ${{ version }}
2724
build:
25+
flags:
26+
- ${{ variant }}
2827
string: "0_${{ abi_tag }}"
2928
files:
3029
exclude:
3130
- "*.o"
3231
script:
33-
file: ../build.sh
32+
file: build.sh
3433
env:
3534
PYTHON_VARIANT: ${{ variant }}
3635
python:

Tools/pixi-packages/tsan-freethreading/pixi.toml

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

0 commit comments

Comments
 (0)