From b1a2ac13799809db4bfb3613a19599224155869c Mon Sep 17 00:00:00 2001 From: Devin Smith Date: Mon, 4 Feb 2019 11:18:49 -0600 Subject: [PATCH] Deephaven specific edits - this should *not* be backported to jpy --- .gitignore | 4 ++-- README-deephaven.md | 27 +++++++++++++++++++++++ setup.py | 54 ++++++++++++++++++++++++++++++++++----------- 3 files changed, 70 insertions(+), 15 deletions(-) create mode 100644 README-deephaven.md diff --git a/.gitignore b/.gitignore index 8d24aec..7655013 100644 --- a/.gitignore +++ b/.gitignore @@ -13,10 +13,10 @@ winbuild.log local.dat setup.out *.pyc -jpy.egg-info +deephaven_jpy.egg-info lib/ .vagrant Vagrantfile *.so *.dll - +.gradle diff --git a/README-deephaven.md b/README-deephaven.md new file mode 100644 index 0000000..49c109a --- /dev/null +++ b/README-deephaven.md @@ -0,0 +1,27 @@ +Deephaven jpy +============= + +This package is a fork of jpy https://github.com/bcdev/jpy.git maintained by Deephaven Data Labs. + + +Installation +------------ + +- Note that "deephaven-jpy" is not compatible with "jpy" as they both install shared libraries with the same name. +- If you already have "jpy" installed, it should be removed before installing "deephaven-jpy" + +``` + + # Remove jpy if it is currently installed + pip uninstall jpy + + # Install deephaven-jpy + pip install deephaven-jpy + +``` + +Usage +----- + + >>> import jpy + >>> ... diff --git a/setup.py b/setup.py index 8278198..fa8f559 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ # limitations under the License. import sys import os -import os.path +import re import platform import subprocess import shutil @@ -37,7 +37,30 @@ __author__ = jpyutil.__author__ __copyright__ = jpyutil.__copyright__ __license__ = jpyutil.__license__ -__version__ = jpyutil.__version__ + +def lookup_version(): + uppath = lambda _path, n: os.sep.join(_path.split(os.sep)[:-n]) + iris_root = uppath(os.path.abspath(__file__), 3) + gradle_properties = os.path.join(iris_root, "gradle.properties") + + if not os.path.exists(gradle_properties): + raise ValueError("The gradle.properties file does not exist at {}".format(iris_root)) + + # fetch the version string from the gradle.properties file + with open(gradle_properties, 'r') as f: + check = re.search('versionSource=(.*?)\n', f.read().strip()) + + if check is None: + raise ValueError("The deephaven release version (versionSource=`version`) " + "could not be discovered in {}".format(gradle_properties)) + + release_name = check.group(1) + + release_version = os.path.join(iris_root, 'gradle', 'versions', release_name) + with open(release_version, 'r') as f: + return f.read().strip() + +__version__ = lookup_version() base_dir = os.path.dirname(os.path.relpath(__file__)) src_main_c_dir = os.path.join(base_dir, 'src', 'main', 'c') @@ -53,6 +76,9 @@ print('Note that you can use non-standard global option [--maven] ' 'to force a Java Maven build for the jpy Java API') +# todo: consider if we actually need to do this +skip_write_jpy_config = True + sources = [ os.path.join(src_main_c_dir, 'jpy_module.c'), os.path.join(src_main_c_dir, 'jpy_diag.c'), @@ -130,7 +156,7 @@ define_macros = [] extra_link_args = [] -extra_compile_args = [] +extra_compile_args = ["-std=c99"] if platform.system() == 'Windows': define_macros += [('WIN32', '1')] @@ -221,6 +247,8 @@ def _write_jpy_config(target_dir=None, install_dir=None): Write out a well-formed jpyconfig.properties file for easier Java integration in a given location. """ + if skip_write_jpy_config: + return None if not target_dir: target_dir = _build_dir() @@ -310,16 +338,16 @@ def run(self): install.run(self) -setup(name='jpy', - description='Bi-directional Python-Java bridge', - long_description=_read('README.md') + '\n\n' + _read('CHANGES.md'), +setup(name='deephaven-jpy', + description='Deephaven fork of jpy Bi-directional Python-Java bridge', + long_description=_read('README-deephaven.md') + '\n\n' + _read('CHANGES.md'), version=__version__, long_description_content_type='text/markdown', platforms='Windows, Linux, Darwin', - author=__author__, - author_email='norman.fomferra@brockmann-consult.de', - maintainer='Brockmann Consult GmbH', - maintainer_email='norman.fomferra@brockmann-consult.de', + author='Deephaven Data Labs', + author_email='python@deephaven.io', + maintainer='Deephaven Data Labs', + maintainer_email='python@deephaven.io', license=__license__, url='https://github.com/bcdev/jpy', download_url='https://pypi.python.org/pypi/jpy/' + __version__, @@ -362,6 +390,6 @@ def run(self): 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5']) + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7'])