diff --git a/.travis.yml b/.travis.yml index 3248653..650337e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,10 @@ language: java env: - PYTHON_VERSION="2.7" - PYTHON_VERSION="3.5" +jdk: + - oraclejdk8 + - oraclejdk9 + - openjdk7 before_install: # Get the tag if it wasn't provided. Travis doesn't provide this if it isn't a tagged build. - if [ -z $TRAVIS_TAG ]; then TRAVIS_TAG=`git tag --contains` ; fi diff --git a/_javabridge.pyx b/_javabridge.pyx index f46d452..03ed2cf 100644 --- a/_javabridge.pyx +++ b/_javabridge.pyx @@ -1650,7 +1650,8 @@ cdef class JB_Env: ''' cdef: jobject o - o = self.env[0].NewStringUTF(self.env, s.encode('utf-8')) + sutf8 = s.encode('utf-8') + o = self.env[0].NewStringUTF(self.env, sutf8) if o == NULL: raise MemoryError("Failed to allocate string") jbo, e = make_jb_object(self, o) diff --git a/javabridge/locate.py b/javabridge/locate.py index b096881..21b0420 100644 --- a/javabridge/locate.py +++ b/javabridge/locate.py @@ -114,7 +114,7 @@ def get_out(cmd): java_bin = get_out(["bash", "-c", "type -p java"]) java_dir = get_out(["readlink", "-f", java_bin]) java_version_string = get_out(["bash", "-c", "java -version"]) - if re.match('^openjdk', java_version_string) is not None: + if re.search('(?i)openjdk', java_version_string) is not None: jdk_dir = os.path.join(java_dir, "..", "..", "..") elif re.match('^java', java_version_string) is not None: jdk_dir = os.path.join(java_dir, "..", "..") @@ -209,7 +209,7 @@ def find_jre_bin_jdk_so(): for jre_home in (java_home, os.path.join(java_home, "jre")): jre_bin = os.path.join(jre_home, 'bin') jre_libexec = os.path.join(jre_home, 'bin' if is_win else 'lib') - arches = ('amd64', 'i386') if is_linux else ('',) + arches = ('amd64', 'i386', '') if is_linux else ('',) lib_prefix = '' if is_win else 'lib' lib_suffix = '.dll' if is_win else ('.dylib' if is_mac else '.so') for arch in arches: diff --git a/javabridge/tests/test_jutil.py b/javabridge/tests/test_jutil.py index 150e39b..5293fa7 100644 --- a/javabridge/tests/test_jutil.py +++ b/javabridge/tests/test_jutil.py @@ -270,7 +270,9 @@ def test_03_05_cw_get_annotations(self): annotations = c.getAnnotations() annotations = javabridge.get_env().get_object_array_elements(annotations) self.assertEqual(len(annotations), 1) - self.assertEqual(javabridge.to_string(annotations[0]),'@java.lang.Deprecated()') + expected = '@java.lang.Deprecated' + self.assertEqual( + javabridge.to_string(annotations[0])[:len(expected)], expected) def test_03_06_cw_get_constructors(self): c = javabridge.get_class_wrapper('java.lang.String') diff --git a/setup.py b/setup.py index 965b163..d400d2a 100644 --- a/setup.py +++ b/setup.py @@ -53,6 +53,7 @@ def build_cython(): compile them. """ + distutils.log.info("Building Cython extensions") stems = ['_javabridge', '_javabridge_mac', '_javabridge_nomac'] pyx_filenames = [in_cwd(s + '.pyx') for s in stems] c_filenames = [in_cwd(s + '.c') for s in stems] @@ -62,6 +63,7 @@ def build_cython(): if len(nc_pyx_filenames) > 0: cmd = ['cython'] + nc_pyx_filenames subprocess.check_call(cmd) + assert all(map(os.path.exists, c_filenames)) def get_jvm_include_dirs(): '''Return a sequence of paths to include directories for JVM defs''' @@ -109,7 +111,7 @@ def ext_modules(): # Build libjvm from jvm.dll on Windows. # This assumes that we're using mingw32 for build # - # generate the jvm.def file matching to the jvm.dll + # generate the jvm.def file matching to the jvm.dll cmd = ["gendef", os.path.join(jdk_home,"jre\\bin\\server\\jvm.dll")] p = subprocess.Popen(cmd) p.communicate() @@ -172,11 +174,12 @@ def package_path(relpath): class build_ext(_build_ext): java2cpython_sources = ["java/org_cellprofiler_javabridge_CPython.c"] def run(self, *args, **kwargs): - self.build_java() - result = build_cython() if self.inplace: dirty = False for source in self.get_source_files(): + if not os.path.exists(source): + dirty = True + break source_mtime = os.stat(source).st_mtime for output in self.get_outputs(): if not os.path.isfile(output) or \ @@ -193,9 +196,11 @@ def run(self, *args, **kwargs): dirty = True else: dirty = True + result = build_cython() if dirty: result = _build_ext.run(self, *args, **kwargs) self.build_java2cpython() + self.build_java() return result def build_jar_from_sources(self, jar, sources): @@ -253,7 +258,7 @@ def build_java2cpython(self): output_dir=output_dir, debug=self.debug, library_dirs=library_dirs, - libraries=libraries, + libraries=libraries, export_symbols=export_symbols, extra_postargs=extra_postargs) if needs_manifest: @@ -385,7 +390,7 @@ def get_version(): install_requires=['numpy'], tests_require="nose", entry_points={'nose.plugins.0.10': [ - 'javabridge = javabridge.noseplugin:JavabridgePlugin' + 'javabridge = javabridge.noseplugin:JavabridgePlugin' ]}, test_suite="nose.collector", package_data={"javabridge": [