Skip to content

Commit fe9c816

Browse files
committed
Simplify Mac OS X builds on Travis CI
1 parent 4c91364 commit fe9c816

1 file changed

Lines changed: 14 additions & 41 deletions

File tree

scripts/mac-os-x-on-travis.sh

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,17 @@
1-
#!/bin/bash -x
2-
3-
# An experiment inspired by https://github.com/travis-ci/travis-ci/issues/2312#issuecomment-195620855.
4-
5-
find_program () {
6-
local matches="$(which -a "$1")"
7-
echo "Matches for '$1' program on PATH:"
8-
if [ -z "$matches" ]; then
9-
echo " - (none)"
10-
else
11-
echo "$matches" | while read PATHNAME; do
12-
if [ -x "$PATHNAME" ]; then
13-
VERSION=$("$PATHNAME" --version 2>&1)
14-
echo " - $VERSION ($PATHNAME)"
15-
fi
16-
done
17-
fi
18-
}
1+
#!/bin/bash -e
2+
3+
# Even though Travis CI supports Mac OS X [1] and several Python interpreters
4+
# are installed out of the box, the Python environment cannot be configured in
5+
# the Travis CI build configuration [2].
6+
#
7+
# As a workaround the build configuration file specifies a single Mac OS X job
8+
# with `language: generic' that runs this script from the `before_install'
9+
# section to create a Python virtual environment.
10+
#
11+
# [1] https://github.com/travis-ci/travis-ci/issues/216
12+
# [2] https://github.com/travis-ci/travis-ci/issues/2312
1913

2014
if [ "$TRAVIS_OS_NAME" = osx ]; then
21-
22-
# Show the installed Python interpreters.
23-
for program in python{,{2{,.6,.7},3{,.4,.5}}}; do
24-
find_program "$program"
25-
done
26-
27-
# Show the installed `virtualenv' version.
28-
find_program virtualenv
29-
30-
# I'm getting the distinct impression that I don't even need Homebrew
31-
# to install Python 2.7 on Mac OS X because it's already available?!
32-
if ! which python2.7 &>/dev/null; then
33-
brew update
34-
brew install python
35-
fi
36-
37-
# But do I still need this as an alternative to the Travis CI Python runtime support?
38-
virtualenv osx-env
39-
source osx-env/bin/activate
40-
41-
# Show the Python version inside the virtual environment.
42-
find_program "python"
43-
15+
virtualenv ~/virtualenv
16+
source ~/virtualenv/bin/activate
4417
fi

0 commit comments

Comments
 (0)