Skip to content

Commit

Permalink
Deephaven specific edits - this should *not* be backported to jpy
Browse files Browse the repository at this point in the history
  • Loading branch information
devinrsmith committed Jul 30, 2019
1 parent 3e1d517 commit b1a2ac1
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ winbuild.log
local.dat
setup.out
*.pyc
jpy.egg-info
deephaven_jpy.egg-info
lib/
.vagrant
Vagrantfile
*.so
*.dll

.gradle
27 changes: 27 additions & 0 deletions README-deephaven.md
Original file line number Diff line number Diff line change
@@ -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
>>> ...
54 changes: 41 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
import sys
import os
import os.path
import re
import platform
import subprocess
import shutil
Expand All @@ -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')
Expand All @@ -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'),
Expand Down Expand Up @@ -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')]
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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='[email protected]',
maintainer='Brockmann Consult GmbH',
maintainer_email='[email protected]',
author='Deephaven Data Labs',
author_email='[email protected]',
maintainer='Deephaven Data Labs',
maintainer_email='[email protected]',
license=__license__,
url='https://github.com/bcdev/jpy',
download_url='https://pypi.python.org/pypi/jpy/' + __version__,
Expand Down Expand Up @@ -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'])

0 comments on commit b1a2ac1

Please sign in to comment.