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

Add support for CIBW_ENVIRONMENT #149

Closed
pllim opened this issue Aug 19, 2023 · 5 comments
Closed

Add support for CIBW_ENVIRONMENT #149

pllim opened this issue Aug 19, 2023 · 5 comments

Comments

@pllim
Copy link
Contributor

pllim commented Aug 19, 2023

I need something like this to build wheel for Python 3.12 for packages with C stuff that needs unreleased numpy 1.26b. Unfortunately, I don't know if it is possible from your workflow here. Please help. Thanks!

https://github.com/scipy/scipy/blob/34366e000b3f37732c4254476e0d6df1857f1f70/.github/workflows/wheels.yml#L136C11-L136C27

Related PRs:

@ConorMacBride
Copy link
Member

I think this should already be possible with the env option. Please let me know if that works

@pllim
Copy link
Contributor Author

pllim commented Aug 19, 2023

Indeed, env works. Thanks!

@pllim pllim closed this as completed Aug 19, 2023
@pllim
Copy link
Contributor Author

pllim commented Aug 19, 2023

So while this works, it also un-discriminatorily pulls down numpy 1.26b for everything, not just the cp312 stuff. This also breaks all the win32 jobs because I guess this new numpy does not ship win32 wheels no more.

      env: |
        CIBW_ENVIRONMENT: PIP_PRE=1

What is the best way to tell the workflow to only do it for certain Python version here? Or do I need a totally separate workflow just for cp312.

@ConorMacBride
Copy link
Member

You could try:

env: |
    CIBW_ENVIRONMENT: 'PIP_PRE=$( if [ "${CIBW_BUILD:0:5}" = "cp312" ]; then echo 1; else echo 0; fi )'

A neater solution might be to configure CIBW_BEFORE_ALL, either as an env var or in pyproject.yaml. It could call a script that sets env vars.

@pllim
Copy link
Contributor Author

pllim commented Aug 19, 2023

Alas, something isn't quite right in the if-else syntax you provided. The "else" seems to work but "then" failed to assign 1 to the variable. I get this:

e476a803-2995-460c-b317-5d3068b425a5.sh: 3: Bad substitution
{
  "CIBW_ENVIRONMENT": "PIP_PRE="
}
...
CIBW_ENVIRONMENT: PIP_PRE=
CIBW_BUILD: cp312-manylinux_x86_64

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

No branches or pull requests

2 participants