Skip to content

Commit

Permalink
Also deduplicate Pyenv env vars for OSX
Browse files Browse the repository at this point in the history
Realized this is a better design while working on pantsbuild#7261.
  • Loading branch information
Eric-Arellano committed Feb 19, 2019
1 parent ad45b2d commit dc36d94
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 23 deletions.
13 changes: 3 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,8 @@ py36_osx_config: &py36_osx_config
packages: &py36_osx_config_brew_packages
- openssl
env:
# Fix Python 3 issue linking to OpenSSL
- &py36_osx_config_env >
PATH="/usr/local/opt/openssl/bin:$PATH" LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include"
PYENV_ROOT="${HOME}/.pyenv"
PATH="${PYENV_ROOT}/shims:${PATH}"
PATH="/usr/local/opt/openssl/bin:$PATH" LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include" PYENV_ROOT="${HOME}/.pyenv" PATH="${PYENV_ROOT}/shims:${PATH}"
before_install:
- curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-osx-amd64 -o /usr/local/bin/jq
- chmod 755 /usr/local/bin/jq
Expand Down Expand Up @@ -206,9 +203,7 @@ py36_osx_test_config: &py36_osx_test_config
env:
# Must duplicate py36_osx_config's env because it cannot be merged into a new anchor
- &py36_osx_test_config_env >
PATH="/usr/local/opt/openssl/bin:$PATH" LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include"
PYENV_ROOT="${HOME}/.pyenv"
PATH="${PYENV_ROOT}/shims:${PATH}"
PATH="/usr/local/opt/openssl/bin:$PATH" LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include" PYENV_ROOT="${HOME}/.pyenv" PATH="${PYENV_ROOT}/shims:${PATH}"
BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.osx

linux_with_fuse: &linux_with_fuse
Expand Down Expand Up @@ -463,11 +458,9 @@ py27_osx_build_wheels_ucs4: &py27_osx_build_wheels_ucs4
- *py27_osx_test_config_env
- *base_build_wheels_env
- CACHE_NAME=osxwheelsbuild.ucs4
- PATH="/usr/local/opt/openssl/bin:$PATH" LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include"
- PATH="/usr/local/opt/openssl/bin:$PATH" LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include" PYENV_ROOT="${HOME}/.pyenv" PATH="${PYENV_ROOT}/shims:${PATH}"

- PYTHON_CONFIGURE_OPTS=--enable-unicode=ucs4
- PYENV_ROOT="${HOME}/.pyenv"
- PATH="${PYENV_ROOT}/shims:${PATH}"
- RUN_PANTS_FROM_PEX=0
before_install:
- curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-osx-amd64 -o /usr/local/bin/jq
Expand Down
1 change: 1 addition & 0 deletions build-support/travis/env_osx_with_pyenv.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PATH="/usr/local/opt/openssl/bin:$PATH" LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include" PYENV_ROOT="${HOME}/.pyenv" PATH="${PYENV_ROOT}/shims:${PATH}"
4 changes: 2 additions & 2 deletions build-support/travis/generate_travis_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_mustache_file(file_name):
template = get_mustache_file('travis.yml.mustache')
before_install_linux = get_mustache_file('before_install_linux.mustache')
before_install_osx = get_mustache_file('before_install_osx.mustache')
osx_openssl_env = get_mustache_file('osx_openssl_env.mustache')
env_osx_with_pyenv = get_mustache_file('env_osx_with_pyenv.mustache')

context = {
'header': HEADER,
Expand All @@ -45,6 +45,6 @@ def get_mustache_file(file_name):
renderer = pystache.Renderer(partials={
'before_install_linux': before_install_linux,
'before_install_osx': before_install_osx,
'osx_openssl_env': osx_openssl_env
'env_osx_with_pyenv': env_osx_with_pyenv
})
print(renderer.render(template, context))
1 change: 0 additions & 1 deletion build-support/travis/osx_openssl_env.mustache

This file was deleted.

13 changes: 3 additions & 10 deletions build-support/travis/travis.yml.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,8 @@ py36_osx_config: &py36_osx_config
packages: &py36_osx_config_brew_packages
- openssl
env:
# Fix Python 3 issue linking to OpenSSL
- &py36_osx_config_env >
{{>osx_openssl_env}}
PYENV_ROOT="${HOME}/.pyenv"
PATH="${PYENV_ROOT}/shims:${PATH}"
{{>env_osx_with_pyenv}}
before_install:
{{>before_install_osx}}
# Clone pyenv directly from GitHub. For multiple osx images, brew's version of pyenv is too old to get
Expand Down Expand Up @@ -190,9 +187,7 @@ py36_osx_test_config: &py36_osx_test_config
env:
# Must duplicate py36_osx_config's env because it cannot be merged into a new anchor
- &py36_osx_test_config_env >
{{>osx_openssl_env}}
PYENV_ROOT="${HOME}/.pyenv"
PATH="${PYENV_ROOT}/shims:${PATH}"
{{>env_osx_with_pyenv}}
BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.osx
linux_with_fuse: &linux_with_fuse
Expand Down Expand Up @@ -442,10 +437,8 @@ py27_osx_build_wheels_ucs4: &py27_osx_build_wheels_ucs4
- *py27_osx_test_config_env
- *base_build_wheels_env
- CACHE_NAME=osxwheelsbuild.ucs4
- {{>osx_openssl_env}}
- {{>env_osx_with_pyenv}}
- PYTHON_CONFIGURE_OPTS=--enable-unicode=ucs4
- PYENV_ROOT="${HOME}/.pyenv"
- PATH="${PYENV_ROOT}/shims:${PATH}"
- RUN_PANTS_FROM_PEX=0
before_install:
{{>before_install_osx}}
Expand Down

0 comments on commit dc36d94

Please sign in to comment.