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

Taichi build on macOS with Python 3.6 to Python 3.8 covered #409 #513

Merged
merged 5 commits into from
Feb 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ matrix:
- os: osx
osx_image: xcode10.3
env:
- MATRIX_EVAL="CC=clang && CXX=clang++ && PYTHON=python3.7"
- MATRIX_EVAL="CC=clang && CXX=clang++ && PYTHON_VERSION=3.6.1 && PYTHON=python"
- os: osx
osx_image: xcode10.3
env:
- MATRIX_EVAL="CC=clang && CXX=clang++ && PYTHON_VERSION=3.7.1 && PYTHON=python"
- os: osx
osx_image: xcode10.3
env:
- MATRIX_EVAL="CC=clang && CXX=clang++ && PYTHON_VERSION=3.8.1 && PYTHON=python"

before_install:
- eval "${MATRIX_EVAL}"
Expand All @@ -26,8 +34,12 @@ before_install:
- cd ..
- llvm-config --version

install:
- .travis/install.sh

script:
- cd $TRAVIS_BUILD_DIR
- export PATH="$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH"
- $PYTHON ci_setup.py ci
- export TAICHI_REPO_DIR=$TRAVIS_BUILD_DIR
- export PYTHONPATH=$TAICHI_REPO_DIR/python
Expand Down
15 changes: 15 additions & 0 deletions .travis/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# use brew & pyenv to build specific python on osx
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
export PATH="$HOME/.pyenv/bin:$PATH"
eval "${MATRIX_EVAL}"
echo "python version: $PYTHON_VERSION"
brew update > /dev/null
brew upgrade pyenv
# use pyenv to build python
eval "$(pyenv init -)"
pyenv install $PYTHON_VERSION
pyenv global $PYTHON_VERSION
pyenv rehash
fi
4 changes: 3 additions & 1 deletion ci_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ def execute_command(line, allow_nonzero_output = 0):

def get_os_name():
name = platform.platform()
if name.lower().startswith('darwin'):
# in python 3.8, platform.platform() uses mac_ver() on macOS
# it will return 'macOS-XXXX' instead of 'Darwin-XXXX'
if name.lower().startswith('darwin') or name.lower().startswith('macos'):
return 'osx'
elif name.lower().startswith('windows'):
return 'win'
Expand Down
4 changes: 3 additions & 1 deletion python/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@

def get_os_name():
name = platform.platform()
if name.lower().startswith('darwin'):
# in python 3.8, platform.platform() uses mac_ver() on macOS
# it will return 'macOS-XXXX' instead of 'Darwin-XXXX'
if name.lower().startswith('darwin') or name.lower().startswith('macos'):
return 'osx'
elif name.lower().startswith('windows'):
return 'win'
Expand Down
4 changes: 3 additions & 1 deletion python/taichi/misc/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

def get_os_name():
name = platform.platform()
if name.lower().startswith('darwin'):
# in python 3.8, platform.platform() uses mac_ver() on macOS
# it will return 'macOS-XXXX' instead of 'Darwin-XXXX'
if name.lower().startswith('darwin') or name.lower().startswith('macos'):
return 'osx'
elif name.lower().startswith('windows'):
return 'win'
Expand Down