Skip to content

Commit

Permalink
Merge branch 'master' into ignore-unrecognized
Browse files Browse the repository at this point in the history
  • Loading branch information
marscher committed Nov 4, 2018
2 parents 2205ca9 + e4d445e commit 2828046
Show file tree
Hide file tree
Showing 222 changed files with 23,382 additions and 23,766 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.6.2
current_version = 0.6.3
commit = True
tag = True

Expand Down
12 changes: 12 additions & 0 deletions .gitattributes
@@ -0,0 +1,12 @@
* test=auto

# Specify lf for all source files
*.py text eol=lf
*.cpp text eol=lf
*.c text eol=lf
*.h text eol=lf

*.xml text eol=lf
*.txt text
.gitignore text eol=lf
.gitattributes text eol=lf
8 changes: 4 additions & 4 deletions .travis.yml
Expand Up @@ -21,23 +21,23 @@ addons:

env:
# one build with and without numpy support (opt numpy out)
- NUMPY="--install-option=--disable-numpy"
- NUMPY="--global-option=--disable-numpy"
- NUMPY=""

matrix:
allow_failures:
- python: 'pypy'
env: NUMPY="--install-option=--disable-numpy"
env: NUMPY="--global-option=--disable-numpy"
- python: 'pypy3'
env: NUMPY="--install-option=--disable-numpy"
env: NUMPY="--global-option=--disable-numpy"
- python: 'pypy'
env: NUMPY=""
- python: 'pypy3'
env: NUMPY=""
- python: 'nightly'
env: NUMPY=""
- python: 'nightly'
env: NUMPY="--install-option=--disable-numpy"
env: NUMPY="--global-option=--disable-numpy"

install:
- pip install . $NUMPY
Expand Down
2 changes: 2 additions & 0 deletions AUTHORS.rst
Expand Up @@ -21,3 +21,5 @@ Huge thanks to these CONTRIBUTORS:
* Kristi
* Martin K. Scherer
* Dongwon Shin
* rbprogrammer
* Karl Einar Nelson
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -3,5 +3,6 @@ recursive-include examples *
include *.rst doc/* LICENSE
# include everything under test/
graft test
graft setupext
global-exclude *.pyc
prune test/classes
2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -4,7 +4,7 @@ environment:
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"
ANT_HOME: "C:\\ProgramData\\chocolatey\\lib\\ant\\apache-ant-1.10.1"
ANT_HOME: "C:\\ProgramData\\chocolatey\\lib\\ant\\apache-ant-1.10.5"
NUMPY_: "numpy x.x"
JAVA_HOME: "C:\\jdk8"
CINST_OPTS:
Expand Down
40 changes: 27 additions & 13 deletions doc/CHANGELOG.rst
Expand Up @@ -8,47 +8,61 @@ This changelog *only* contains changes from the *first* pypi release (0.5.4.3) o
Use `ignoreUnrecognized=True` to get previous behavior.

- Java reference counting has been converted to use JNI
- Added extra verbiage to the to the raised exception when an overloaded
method could not be matched. It now prints a list of all possible method
signatures.
- Harded code to unattached threads and accessing java objects after shutdown.
- The following is now DEPRECATED
- jpype.reflect.* - All class information is available with .class_
- Python thread option for JPypeReferenceQueue. References are always handled with
with the Java cleanup routine. The undocumented setUsePythonThreadForDaemon()
will be removed at a future version.
- promoted --install-option to a --global-option as it applies to the build as well
as install.

- **0.6.3 - 2018-04-03**
- Java reference counting has been converted to use JNI
PushLocalFrame/PopLocalFrame. Several resource leaks
were removed.

- java.lang.Class<>.forName() will now return the java.lang.Class.
- java.lang.Class<>.forName() will now return the java.lang.Class.
Work arounds for requiring the class loader are no longer needed.
Customizers now support customization of static members.

- Support of java.lang.Class<>
- java.lang.Object().getClass() on Java objects returns a java.lang.Class
- Support of java.lang.Class<>
- java.lang.Object().getClass() on Java objects returns a java.lang.Class
rather than the Python class
- java.lang.Object().__class__ on Java objects returns the python class
- java.lang.Object().__class__ on Java objects returns the python class
as do all python objects
- java.lang.Object.class_ maps to the java statement 'java.lang.Object.class' and
returns the java.lang.Class<java.lang.Object>
returns the java.lang.Class<java.lang.Object>
- java.lang.Class supports reflection methods
- private fields and methods can be accessed via reflection
- annotations are avaiable via reflection

- Java objects and arrays will not accept setattr unless the
attribute corresponds to a java method or field whith
the exception of private attributes that begin with
- Java objects and arrays will not accept setattr unless the
attribute corresponds to a java method or field whith
the exception of private attributes that begin with
underscore.

- Added support for automatic conversion of boxed types.
- Added support for automatic conversion of boxed types.
- Boxed types automatically convert to python primitives.
- Boxed types automatically convert to java primitives when resolving functions.
- Functions taking boxed or primitives still resolve based on closest match.

- Python integer primitives will implicitly match java float and double as per
Java specification.

- Added support for try with resources for java.lang.Closeable.
- Added support for try with resources for java.lang.Closeable.
Use python "with MyJavaResource() as resource:" statement
to automatically close a resource at the end of a block.

- **0.6.2 - 2017-01-13**

- Fix JVM location for OSX.
- Fix a method overload bug.
- Add support for synthetic methods
- Add support for synthetic methods

- **0.6.1 - 2015-08-05**

- Fix proxy with arguments issue.
Expand Down Expand Up @@ -136,7 +150,7 @@ This changelog *only* contains changes from the *first* pypi release (0.5.4.3) o
- Fix memory leak in array setters
- Fix memory leak in typemanager
- Add userguide from sourceforge project by @baztian

- **0.5.4.5 - 2013-08-25**

- Added support for OSX 10.9 Mavericks by @rmangino (#16)
Expand Down
13 changes: 10 additions & 3 deletions doc/conf.py
Expand Up @@ -18,7 +18,7 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))

# -- General configuration ------------------------------------------------

Expand All @@ -44,14 +44,21 @@

# General information about the project.
project = u'JPype'
copyright = u'2014, Steve Menard, Luis Nell and others'
copyright = u'2014-18, Steve Menard, Luis Nell and others'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
import mock
mock_modules = ('_jpype',
)
for m in mock_modules:
sys.modules[m] = mock.MagicMock()

import jpype
print(jpype.__path__)
version = jpype.__version__
# The full version, including alpha/beta/rc tags.
release = jpype.__version__
Expand Down Expand Up @@ -138,7 +145,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
#html_static_path = ['_static']

# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
Expand Down
34 changes: 28 additions & 6 deletions doc/install.rst
@@ -1,7 +1,7 @@
Installation
============

Get JPype from the `github <https://github.com/originell/jpype>`__ or
Get JPype from the `github <https://github.com/jpype-project/jpype>`__ or
from `PyPi <http://pypi.python.org/pypi/JPype1>`__. If you are using `Anaconda <https://anaconda.org>`_ Python stack,
you can install pre-compiled binaries from conda-forge for Linux, OSX and Windows.

Expand All @@ -20,12 +20,12 @@ Either the Sun/Oracle JDK/JRE Variant or OpenJDK. Python 2.6+ (including Python
Debian/Ubuntu
~~~~~~~~~~~~~

Debian/Ubuntu users will have to install ``g++`` and ``python-dev``
Debian/Ubuntu users will have to install ``g++``, ``python-dev``, and ``ant``
first:

::

sudo apt-get install g++ python-dev
sudo apt-get install g++ python-dev python3-dev ant

Windows
~~~~~~~
Expand All @@ -35,8 +35,23 @@ Windows users need a Python installation and C++ compilers:
1. Install some version of Python (2.7 or higher), e.g., `Anaconda
<https://www.continuum.io/downloads>`_ is a good choice for users not yet
familiar with the language
2. Install a `Windows C++ Compiler
2. For Python 2 series, Install `Windows C++ Compiler
<http://landinghub.visualstudio.com/visual-cpp-build-tools>`_
3. For Python 3 series, Install `Microsoft Visual Studio 2010 Redistributable Package (x64)
<https://www.microsoft.com/en-us/download/details.aspx?id=14632>`_ and
`Microsoft Build Tools 2015 Update 3
<https://visualstudio.microsoft.com/vs/older-downloads/>`_
4. Install `Apache Ant (tested using 1.9.13)
<https://ant.apache.org/bindownload.cgi>`_

Netbeans ant can be used in place of Apache Ant. Netbeans ant is located in
``${netbeans}/extide/ant/bin/ant.bat``.

The Build Tools 2015 is a pain to find. Microsoft really wants people to download the latest version.
To get to it from the above URL, click on "Redistributables and Build Tools", then select
Microsoft Build Tools 2015 Update 3.

When building for windows you must use the Visual Studio developer command prompt.

Install
-------
Expand All @@ -48,6 +63,14 @@ Should be easy as
python setup.py install


For builds with a specific ant, use

::

python setup.py --ant=C:\My\Ant\Path\ant.bat install



If it fails...
~~~~~~~~~~~~~~

Expand All @@ -60,7 +83,7 @@ This happens mostly due to the setup not being able to find your

``JAVA\_HOME=/usr/lib/java/jdk1.6.0/ python setup.py install``
2. Please create an Issue `on
github <https://github.com/originell/jpype/issues?state=open>`__ and
github <https://github.com/jpype-project/jpype/issues?state=open>`__ and
post all the information you have.

Tested on
Expand All @@ -73,7 +96,6 @@ Tested on
- Debian 7.1 with OpenJDK 1.6.0
- Ubuntu 12.04 with Sun/Oracle JDK 1.6.0


Known Bugs/Limitations
----------------------

Expand Down
14 changes: 7 additions & 7 deletions doc/userguide.rst
Expand Up @@ -173,7 +173,7 @@ array element but can process all data at once.
If you do not want this optional feature, because eg. it depends on NumPy, you
can opt it out in the installation process by passing *"--disable-numpy"* to
*setup.py*. To opt out with pip you need to append the additional argument
*"--install-option='--disable-numpy'*. This possibility exists since version
*"--global-option='--disable-numpy'*. This possibility exists since version
0.5.6.

Creating Java arrays from Python
Expand Down Expand Up @@ -408,26 +408,26 @@ regular Python classes. This contributes to the fact that it is not possible
to catch Java exceptions in a completely straightforward way.

All Java exceptions thrown end up throwing the jpype.JavaException exception.
You can then use the message(), stackTrace() and javaClass() to access
You can then use the message(), stacktrace() and javaClass() to access
extended information.

Here is an example: ::

try :
# Code that throws a java.lang.RuntimeException
except JavaException, ex :
if JavaException.javaClass() is java.lang.RuntimeException :
print "Caught the runtime exception : ", JavaException.message()
print JavaException.stackTrace()
if ex.javaClass() is java.lang.RuntimeException :
print "Caught the runtime exception : ", ex.message()
print ex.stacktrace()

Alternately, you can catch the REAL Java exception directly by using
the JException wrapper. ::

try :
# Code that throws a java.lang.RuntimeException
except jpype.JException(java.lang.RuntimeException), ex :
print "Caught the runtime exception : ", JavaException.message()
print JavaException.stackTrace()
print "Caught the runtime exception : ", ex.message()
print ex.stacktrace()


Known limitations
Expand Down
78 changes: 39 additions & 39 deletions examples/jms/README.TXT
@@ -1,40 +1,40 @@
This example of using JPype and JMS contributed by David Morgenthaler
Here is the message that accompanied it when he posted it on comp.lang.python :
=============================================================================
Your question intrigued me, so I gave it a try. And the anwer (at
least for JMS Publish/Subscribe TextMessages) is YES.
It includes:
- Java classes for a publisher (src/messaging/JpypePublisher) and a
subscriber (src/messaging/JpypeSubscriber). These Java classes, which
do most of the dirty work of connecting to the JMS server, are used
from python via jpype.
- Java classes that test the publisher and subscriber
(src/messaging/testJpepePublisher, src/messaging/testJpypeSubscriber)
- A Java interface that is used by python for the JProxy
- python scripts for publishing and subscribing
- An build.xml for ant to build and run the Java classes
The Java and python publishers and subscribers work in any reasonable
combination (J pub/J sub, J pub/p sub, p pub/p sub, p pub/J sub, and
even with multiple subscribers)
Copy conveniently located folder. You'll find a build.xml for
ant to build the Java. You'll have to edit (in the testers and in the
python scripts) the naming and connection factory stuff for your
situation. You'll also have to edit the python scripts to correctly
locate your jvm and other classpath information. Once you're correctly
configured, you can use ant to build and/or execute the Java (type
"ant help"). And once the Java is built, you can try the python
versions.
I can't imagine that this approach wouldn't work for JMS Queues. And
while I haven't tested it, I don't see anything preventing the use of
other message types (BinaryMessage, ObjectMessage,...).
BTW, I don't detect any noticable slowdown in the python versions from
the Java versions (probably because of the strightforward conversion
of python strings to Java Strings).
This example of using JPype and JMS contributed by David Morgenthaler

Here is the message that accompanied it when he posted it on comp.lang.python :
=============================================================================
Your question intrigued me, so I gave it a try. And the anwer (at
least for JMS Publish/Subscribe TextMessages) is YES.

It includes:
- Java classes for a publisher (src/messaging/JpypePublisher) and a
subscriber (src/messaging/JpypeSubscriber). These Java classes, which
do most of the dirty work of connecting to the JMS server, are used
from python via jpype.
- Java classes that test the publisher and subscriber
(src/messaging/testJpepePublisher, src/messaging/testJpypeSubscriber)
- A Java interface that is used by python for the JProxy
- python scripts for publishing and subscribing
- An build.xml for ant to build and run the Java classes

The Java and python publishers and subscribers work in any reasonable
combination (J pub/J sub, J pub/p sub, p pub/p sub, p pub/J sub, and
even with multiple subscribers)

Copy conveniently located folder. You'll find a build.xml for
ant to build the Java. You'll have to edit (in the testers and in the
python scripts) the naming and connection factory stuff for your
situation. You'll also have to edit the python scripts to correctly
locate your jvm and other classpath information. Once you're correctly
configured, you can use ant to build and/or execute the Java (type
"ant help"). And once the Java is built, you can try the python
versions.

I can't imagine that this approach wouldn't work for JMS Queues. And
while I haven't tested it, I don't see anything preventing the use of
other message types (BinaryMessage, ObjectMessage,...).

BTW, I don't detect any noticable slowdown in the python versions from
the Java versions (probably because of the strightforward conversion
of python strings to Java Strings).

=============================================================================

0 comments on commit 2828046

Please sign in to comment.