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

Fix lib location #362

Closed
wants to merge 2 commits into from
Closed
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
76 changes: 46 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,55 @@
language: python


matrix:
fast_finish: true
include:
- language: python
python: 2.7
os: linux
dist: trusty

- language: python
python: 3.6
os: linux
dist: trusty

- language: python
python: 3.6
os: linux
os: trusty
env: RUN=sdist

before_install:
- sudo apt-get update
- sudo apt-get install python-pip openjdk-7-jdk
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

install:
- if [ "$RUN" != "sdist" ]; then pip install --upgrade cython six; fi;

install:
- sudo apt-get update
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-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
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- conda create -n jnius_env python=$PYTHON_VERSION
- conda activate jnius_env
- conda install openjdk=$JAVA_VERSION cython nose ant pip setuptools

script:
- if [ "$RUN" == "sdist" ]; then
if [ "$PYJNIUS_DEPLOY" == "1" ]; then
pip install twine;
python setup_sdist.py sdist;
python -m twine upload dist/*;
fi;
else
make && make tests;
- conda activate jnius_env
- if [ "$RUN" == "sdist" ]; then
if [ "$PYJNIUS_DEPLOY" == "1" ]; then
conda install twine
python setup_sdist.py sdist
python -m twine upload dist/*
fi;
else
make && make tests;
fi;
23 changes: 23 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ 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)

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),
'{0}/include/darwin'.format(FRAMEWORK)
Expand Down Expand Up @@ -181,6 +193,17 @@ def compile_native_invocation_handler(*possible_homes):
INCL_DIR = join(JDK_HOME, 'include', 'linux')
LIB_LOCATION = 'jre/lib/{}/server/libjvm.so'.format(CPU)

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)

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.so'

INCLUDE_DIRS = [
join(JDK_HOME, 'include'),
INCL_DIR
Expand Down