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

Where to generate env_vars.sh on the fly? #183

Closed
madig opened this issue Jul 2, 2018 · 3 comments
Closed

Where to generate env_vars.sh on the fly? #183

madig opened this issue Jul 2, 2018 · 3 comments

Comments

@madig
Copy link

madig commented Jul 2, 2018

I'm trying to build wheels for freetype-py. What's peculiar about the project is that it does not build an extension, but a plain .so/.dll/.dylib that is accessed through Python's FFI library if available, otherwise the system-provided library is accessed. The setup.py file is set up to look for the presence of the environment variable FREETYPEPY_BUNDLE_FT to decide whether to build an unbundled universal wheel or a bundled platform-specific one. Now, the env var needs to reach the container somehow in Linux (Windows and macOS build correctly), but of course only when I want to bundle a lib. See https://github.com/madig/freetype-py/blob/fix-ci-build/.travis.yml for what I'm doing.

Generating an env_vars.sh in before_install or script doesn't seem work... where to best do it? Or do you have a better idea?

script:
    - if [ $FREETYPEPY_BUNDLE_FT ]; then echo "Bundling FreeType"; echo "FREETYPEPY_BUNDLE_FT=1" > env_vars.sh; else echo "Not bundling FreeType."; fi
    - install_run $PLAT
@anthrotype
Copy link
Contributor

@madig there are two docker images, one for build (for manylinux1 running CentOS 5) and one for test runs (Ubuntu Trusty).
Currently env_vars.sh is only sourced from the build phase. I'm proposing to source it also from the install-and-test phase with #198.

If you generate the env_vars.sh file just before calling install_run then it is too late for it to reach the manylinux docker. The ENV_VARS_PATH has already been (unsuccessfully) sourced by then, from inside docker_build_wrap.sh, which is called by build_multilinux function, in turn called by build_wheel. So to ensure it reaches the manylinux docker where the wheel is built, you need to create env_vars.sh before calling build_wheel. The before_install phase of Travis pipeline would be good place.

@native-api
Copy link
Contributor

before_install is the fn that ultimately causes this file to be sourced.

So you need to generate env_vars.sh in travis.yml, before you call that function.

@mattip
Copy link
Collaborator

mattip commented Oct 23, 2024

The OP has not responded to the suggestion, I hope they have solved the problem. I see the repo has moved to using cibuildwheel. Closing.

@mattip mattip closed this as completed Oct 23, 2024
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

4 participants