Skip to content

Commit

Permalink
Fix Java 8 and Java 9+ detection on OSX, support conda (#364)
Browse files Browse the repository at this point in the history
* Fix OSX setup

* OSX on Travis

* Use generic

* Travis: osx first

* Get correct miniconda version in Travis

* Ix Travis again

* Make travis less verbose

* Travis osx first

* Disable Java 8/OSX

* Use JAVA_HOME for osx

* Fix mistake in variables
  • Loading branch information
hadim authored and KeyWeeUsr committed Nov 24, 2018
1 parent 940b039 commit 8aa9178
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 80 deletions.
98 changes: 27 additions & 71 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,79 +1,35 @@
language: python
language: generic

os:
- osx
- linux

env:
- PYTHON_VERSION="2.7" JAVA_VERSION="8"
- PYTHON_VERSION="3.6" JAVA_VERSION="8"
- PYTHON_VERSION="3.7" JAVA_VERSION="8"
- PYTHON_VERSION="2.7" JAVA_VERSION="9"
- PYTHON_VERSION="3.6" JAVA_VERSION="9"
- PYTHON_VERSION="3.7" JAVA_VERSION="9"
- PYTHON_VERSION="2.7" JAVA_VERSION="10"
- PYTHON_VERSION="3.6" JAVA_VERSION="10"
- PYTHON_VERSION="3.7" JAVA_VERSION="10"
- PYTHON_VERSION="2.7" JAVA_VERSION="11"
- PYTHON_VERSION="3.6" JAVA_VERSION="11"
- PYTHON_VERSION="3.7" JAVA_VERSION="11"

matrix:
fast_finish: true
include:
- language: python
os: linux
env:
- PYTHON_VERSION="2.7"
- JAVA_VERSION="8"
- language: python
os: linux
env:
- PYTHON_VERSION="3.6"
- JAVA_VERSION="8"
- language: python
os: linux
env:
- PYTHON_VERSION="3.7"
- JAVA_VERSION="8"
- language: python
os: linux
env:
- PYTHON_VERSION="3.7"
- JAVA_VERSION="8"
- RUN=sdist
- language: python
os: linux
env:
- PYTHON_VERSION="2.7"
- JAVA_VERSION="9"
- language: python
os: linux
env:
- PYTHON_VERSION="3.6"
- JAVA_VERSION="9"
- language: python
os: linux
env:
- PYTHON_VERSION="3.7"
- JAVA_VERSION="9"
- language: python
os: linux
env:
- PYTHON_VERSION="2.7"
- JAVA_VERSION="10"
- language: python
os: linux
env:
- PYTHON_VERSION="3.6"
- JAVA_VERSION="10"
- language: python
os: linux
env:
- PYTHON_VERSION="3.7"
- JAVA_VERSION="10"
- language: python
os: linux
env:
- PYTHON_VERSION="2.7"
- JAVA_VERSION="11"
- language: python
os: linux
env:
- PYTHON_VERSION="3.6"
- JAVA_VERSION="11"
- language: python
os: linux
env:
- PYTHON_VERSION="3.7"
- JAVA_VERSION="11"


install:
- sudo apt-get update
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh

- if [ "$TRAVIS_OS_NAME" = linux ]; then
sudo apt-get update;
MINICONDAVERSION="Linux";
else
MINICONDAVERSION="MacOSX";
fi;
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-$MINICONDAVERSION-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- echo ". $HOME/miniconda/etc/profile.d/conda.sh" >> $HOME/.bashrc
- source $HOME/.bashrc
Expand Down
20 changes: 11 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,15 @@ def compile_native_invocation_handler(*possible_homes):
)]
else:
LIB_LOCATION = 'jre/lib/server/libjvm.dylib'

if isinstance(JRE_HOME, bytes):
JAVA_HOME = dirname(JRE_HOME.decode())
else:
JAVA_HOME = dirname(JRE_HOME)
FULL_LIB_LOCATION = join(JAVA_HOME, LIB_LOCATION)
FULL_LIB_LOCATION = join(FRAMEWORK, LIB_LOCATION)

if not exists(FULL_LIB_LOCATION):
# In that case, the Java version is very likely >=9.
# So we need to modify the `libjvm.so` path.
LIB_LOCATION = 'lib/server/libjvm.dylib'
JAVA_HOME = getenv('JAVA_HOME')
FULL_LIB_LOCATION = join(JAVA_HOME, LIB_LOCATION)
if not exists(FULL_LIB_LOCATION):
# In that case, the Java version is very likely >=9.
# So we need to modify the `libjvm.so` path.
LIB_LOCATION = 'lib/server/libjvm.dylib'

INCLUDE_DIRS = [
'{0}/include'.format(FRAMEWORK),
Expand Down Expand Up @@ -210,6 +208,10 @@ def compile_native_invocation_handler(*possible_homes):
]

if PLATFORM == 'win32':

if isinstance(JRE_HOME, bytes):
JRE_HOME = JRE_HOME.decode()

LIBRARY_DIRS = [
join(JDK_HOME, 'lib'),
join(JRE_HOME, 'bin', 'server')
Expand Down

0 comments on commit 8aa9178

Please sign in to comment.