Skip to content

Commit

Permalink
Install OpenSSL on OSX UCS4 shard
Browse files Browse the repository at this point in the history
The shard was failing when trying to build cryptography from an sdist because it could not find openssl. So, we now explicitly install it with Brew and modify the env vars to expose it. This is identical to how we install Py3 on OSX.
  • Loading branch information
Eric-Arellano committed Feb 17, 2019
1 parent e87f567 commit 170e9c8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ py36_osx_config: &py36_osx_config
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"
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:
Expand Down Expand Up @@ -208,9 +206,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"
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
Expand Down Expand Up @@ -453,10 +449,16 @@ py27_osx_build_wheels_ucs2: &py27_osx_build_wheels_ucs2
py27_osx_build_wheels_ucs4: &py27_osx_build_wheels_ucs4
<<: *py27_osx_build_wheels_no_ucs
name: "Build OSX wheels (Py27 and UCS4 pantsbuild.pants)"
addons:
brew:
packages:
- openssl
env:
- *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"

- PYTHON_CONFIGURE_OPTS=--enable-unicode=ucs4
- PYENV_ROOT="${HOME}/.pyenv"
- PATH="${PYENV_ROOT}/shims:${PATH}"
Expand Down
17 changes: 10 additions & 7 deletions build-support/travis/generate_travis_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@

def generate_travis_yml():
"""Generates content for a .travis.yml file from templates."""
template = pkg_resources.resource_string(
__name__, 'travis.yml.mustache').decode('utf-8')
before_install_linux = pkg_resources.resource_string(
__name__, 'before_install_linux.mustache').decode('utf-8')
before_install_osx = pkg_resources.resource_string(
__name__, 'before_install_osx.mustache').decode('utf-8')
def get_mustache_file(file_name):
return pkg_resources.resource_string(__name__, file_name).decode('utf-8')

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')

context = {
'header': HEADER,
'py3_integration_shards': range(0, num_py3_integration_shards),
Expand All @@ -42,6 +44,7 @@ def generate_travis_yml():
}
renderer = pystache.Renderer(partials={
'before_install_linux': before_install_linux,
'before_install_osx': before_install_osx
'before_install_osx': before_install_osx,
'osx_openssl_env': osx_openssl_env
})
print(renderer.render(template, context))
1 change: 1 addition & 0 deletions build-support/travis/osx_openssl_env.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"
13 changes: 7 additions & 6 deletions build-support/travis/travis.yml.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ py36_osx_config: &py36_osx_config
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"
{{>osx_openssl_env}}
PYENV_ROOT="${HOME}/.pyenv"
PATH="${PYENV_ROOT}/shims:${PATH}"
before_install:
Expand Down Expand Up @@ -192,9 +190,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"
{{>osx_openssl_env}}
PYENV_ROOT="${HOME}/.pyenv"
PATH="${PYENV_ROOT}/shims:${PATH}"
BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.osx
Expand Down Expand Up @@ -432,10 +428,15 @@ py27_osx_build_wheels_ucs2: &py27_osx_build_wheels_ucs2
py27_osx_build_wheels_ucs4: &py27_osx_build_wheels_ucs4
<<: *py27_osx_build_wheels_no_ucs
name: "Build OSX wheels (Py27 and UCS4 pantsbuild.pants)"
addons:
brew:
packages:
- openssl
env:
- *py27_osx_test_config_env
- *base_build_wheels_env
- CACHE_NAME=osxwheelsbuild.ucs4
- {{>osx_openssl_env}}
- PYTHON_CONFIGURE_OPTS=--enable-unicode=ucs4
- PYENV_ROOT="${HOME}/.pyenv"
- PATH="${PYENV_ROOT}/shims:${PATH}"
Expand Down

0 comments on commit 170e9c8

Please sign in to comment.