Permalink
Browse files

Eol (#326)

* Reenable archival thunk code and rework setup.

* Fixed EOL to LF.
  • Loading branch information...
Thrameos authored and marscher committed Jun 6, 2018
1 parent 5d4a72c commit 490eb6511a0a0b57be2191cbbf3a90bac45e5879
Showing with 18,811 additions and 18,596 deletions.
  1. +12 −0 .gitattributes
  2. +4 −4 .travis.yml
  3. +1 −0 AUTHORS.rst
  4. +2 −0 doc/CHANGELOG.rst
  5. +1 −1 doc/userguide.rst
  6. +39 −39 examples/jms/README.TXT
  7. +35 −35 examples/jms/testJpypePublisher.py
  8. +42 −42 examples/jms/testJpypeSubscriber.py
  9. +20 −20 examples/linux/README.TXT
  10. +20 −20 examples/linux/findjvm.py
  11. +22 −22 examples/linux/jpype.sh
  12. +32 −32 examples/rmi.py
  13. +24 −24 jpype/JClassUtil.py
  14. +42 −42 jpype/__init__.py
  15. +72 −72 jpype/_darwin.py
  16. +36 −36 jpype/_gui.py
  17. +204 −204 jpype/_jarray.py
  18. +295 −295 jpype/_jclass.py
  19. +286 −286 jpype/_jcollection.py
  20. +74 −74 jpype/_jexception.py
  21. +31 −31 jpype/_jobject.py
  22. +60 −60 jpype/_jpackage.py
  23. +71 −71 jpype/_jproxy.py
  24. +187 −187 jpype/_jvmfinder.py
  25. +105 −105 jpype/_jwrapper.py
  26. +64 −64 jpype/_linux.py
  27. +89 −89 jpype/_properties.py
  28. +24 −24 jpype/_pykeywords.py
  29. +30 −30 jpype/_refdaemon.py
  30. +119 −119 jpype/_windows.py
  31. +17 −17 jpype/awt/__init__.py
  32. +27 −27 jpype/awt/event/WindowAdapter.py
  33. +17 −17 jpype/awt/event/__init__.py
  34. +39 −39 jpype/nio.py
  35. +48 −48 jpype/reflect.py
  36. +17 −17 jpypex/__init__.py
  37. +62 −62 jpypex/swing/AbstractAction.py
  38. +17 −17 jpypex/swing/__init__.py
  39. +28 −28 jpypex/swing/pyutils.py
  40. +25 −0 native/build.xml
  41. +70 −70 native/common/include/jp_array.h
  42. +46 −46 native/common/include/jp_arrayclass.h
  43. +108 −108 native/common/include/jp_class.h
  44. +50 −50 native/common/include/jp_classbase.h
  45. +87 −87 native/common/include/jp_env.h
  46. +74 −74 native/common/include/jp_field.h
  47. +153 −153 native/common/include/jp_hostenv.h
  48. +186 −186 native/common/include/jp_jniutil.h
  49. +76 −76 native/common/include/jp_method.h
  50. +88 −88 native/common/include/jp_methodoverload.h
  51. +30 −30 native/common/include/jp_monitor.h
  52. +48 −48 native/common/include/jp_object.h
  53. +27 −27 native/common/include/jp_objectbase.h
  54. +105 −105 native/common/include/jp_objecttypes.h
  55. +70 −70 native/common/include/jp_platform_linux.h
  56. +81 −81 native/common/include/jp_platform_win32.h
  57. +44 −44 native/common/include/jp_proxy.h
  58. +0 −23 native/common/include/jp_reference.h
  59. +90 −90 native/common/include/jp_type.h
  60. +52 −52 native/common/include/jp_typemanager.h
  61. +124 −124 native/common/include/jp_typename.h
  62. +136 −139 native/common/include/jpype.h
  63. +153 −153 native/common/jp_array.cpp
  64. +194 −194 native/common/jp_arrayclass.cpp
  65. +677 −677 native/common/jp_class.cpp
  66. +30 −30 native/common/jp_classbase.cpp
  67. +1,482 −1,482 native/common/jp_env.cpp
  68. +153 −153 native/common/jp_field.cpp
  69. +731 −731 native/common/jp_jniutil.cpp
  70. +300 −300 native/common/jp_method.cpp
  71. +458 −458 native/common/jp_methodoverload.cpp
  72. +37 −37 native/common/jp_monitor.cpp
  73. +110 −110 native/common/jp_object.cpp
  74. +26 −26 native/common/jp_platform_linux.cpp
  75. +25 −25 native/common/jp_platform_win32.cpp
  76. +231 −229 native/common/jp_proxy.cpp
  77. +0 −50 native/common/jp_reference.cpp
  78. +7 −3 native/common/jp_reference_queue.cpp
  79. +173 −173 native/common/jp_typemanager.cpp
  80. +159 −159 native/common/jp_typename.cpp
  81. +101 −101 native/common/jp_voidtype.cpp
  82. +0 −54 native/common/thunk/jp_thunk_invocationhandler.h
  83. +0 −99 native/common/thunk/jp_thunk_reference_queue.h
  84. +14 −0 native/java/jpype/JPypeInvocationHandler.java
  85. +39 −0 native/java/jpype/ref/JPypeReference.java
  86. +99 −0 native/java/jpype/ref/JPypeReferenceQueue.java
  87. +2 −2 native/python/include/jp_cocoatools.h
  88. +18 −18 native/python/include/jp_runloopstopper.h
  89. +104 −104 native/python/include/jpype_python.h
  90. +58 −58 native/python/include/py_class.h
  91. +41 −41 native/python/include/py_field.h
  92. +245 −245 native/python/include/py_hostenv.h
  93. +56 −56 native/python/include/py_method.h
  94. +35 −35 native/python/include/py_monitor.h
  95. +261 −261 native/python/include/pythonenv.h
  96. +246 −246 native/python/jpype_javaarray.cpp
  97. +51 −51 native/python/jpype_javaclass.cpp
  98. +59 −59 native/python/jpype_javanio.cpp
  99. +359 −359 native/python/jpype_module.cpp
  100. +231 −231 native/python/jpype_python.cpp
  101. +397 −397 native/python/py_class.cpp
  102. +222 −222 native/python/py_field.cpp
  103. +654 −654 native/python/py_hostenv.cpp
  104. +405 −405 native/python/py_method.cpp
  105. +103 −103 native/python/py_monitor.cpp
  106. +562 −562 native/python/pythonenv.cpp
  107. +14 −186 setup.py
  108. +7 −0 setupext/__init__.py
  109. +87 −0 setupext/build_ext.py
  110. +29 −0 setupext/build_java.py
  111. +146 −0 setupext/build_thunk.py
  112. +15 −0 setupext/dist.py
  113. +89 −0 setupext/platform.py
  114. +28 −0 setupext/test_java.py
  115. +16 −0 setupext/utils.py
  116. +24 −24 test/buf_leak_test.py
  117. +54 −54 test/buf_leak_test3.py
  118. +26 −25 test/build.xml
  119. +117 −117 test/convtest.py
  120. +20 −20 test/findjvm.py
  121. +12 −12 test/harness/jpype/array/Test2.java
  122. +47 −47 test/harness/jpype/array/TestArray.java
  123. +12 −12 test/harness/jpype/attr/ClassWithBuffer.java
  124. +21 −21 test/harness/jpype/attr/Holder.java
  125. +20 −20 test/harness/jpype/attr/SubHolder.java
  126. +132 −132 test/harness/jpype/attr/Test1.java
  127. +40 −40 test/harness/jpype/attr/Test2.java
  128. +51 −51 test/harness/jpype/exc/ExceptionTest.java
  129. +21 −21 test/harness/jpype/exc/ExceptionThrower.java
  130. +21 −21 test/harness/jpype/mro/A.java
  131. +20 −20 test/harness/jpype/mro/B.java
  132. +22 −22 test/harness/jpype/mro/C.java
  133. +20 −20 test/harness/jpype/mro/D.java
  134. +20 −20 test/harness/jpype/mro/E.java
  135. +20 −20 test/harness/jpype/mro/F.java
  136. +37 −37 test/harness/jpype/nio/NioReceive.java
  137. +24 −24 test/harness/jpype/numeric/NumericTest.java
  138. +49 −49 test/harness/jpype/objectwrapper/Test1.java
  139. +66 −66 test/harness/jpype/proxy/ProxyTriggers.java
  140. +24 −24 test/harness/jpype/proxy/TestInterface2.java
  141. +21 −21 test/harness/jpype/proxy/TestInterface3.java
  142. +44 −44 test/harness/jpype/ref/TestReferenceQeue.java
  143. +23 −23 test/harness/jpype/rmi/IServer.java
  144. +59 −59 test/harness/jpype/rmi/ServerImpl.java
  145. +20 −20 test/harness/jpype/serial/SerializationTest.java
  146. +124 −124 test/harness/jpype/xml/DelegateHandler.java
  147. +57 −57 test/java_dom.py
  148. +74 −74 test/java_sax.py
  149. +55 −55 test/jpypetest/__init__.py
  150. +287 −287 test/jpypetest/array.py
  151. +272 −272 test/jpypetest/attr.py
  152. +48 −48 test/jpypetest/common.py
  153. +83 −83 test/jpypetest/exc.py
  154. +27 −27 test/jpypetest/mro.py
  155. +85 −85 test/jpypetest/numeric.py
  156. +82 −82 test/jpypetest/objectwrapper.py
  157. +166 −166 test/jpypetest/overloads.py
  158. +146 −146 test/jpypetest/proxy.py
  159. +55 −55 test/jpypetest/serial.py
  160. +31 −31 test/lists_and_maps.py
  161. +49 −49 test/python_dom.py
  162. +2,137 −2,137 test/sample/big.xml
  163. +23 −23 test/stub.py
  164. +16 −16 test/test_awt.py
  165. +1 −1 test/test_jarray_fixes.py
  166. +33 −33 test/testlucene.py
  167. +49 −49 test/testsuite.py
@@ -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
@@ -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
@@ -22,3 +22,4 @@ Huge thanks to these CONTRIBUTORS:
* Martin K. Scherer
* Dongwon Shin
* rbprogrammer
* Karl Einar Nelson
@@ -13,6 +13,8 @@ This changelog *only* contains changes from the *first* pypi release (0.5.4.3) o
- 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
@@ -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
@@ -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).
=============================================================================
@@ -1,35 +1,35 @@
from jpype import *
import time
NUMMSGS = 10
def pyPublisher (javaNamingFactory="weblogic.jndi.WLInitialContextFactory",
javaNamingProvider="t3://158.188.40.21:7001",
connectionFactory="weblogic.jms.ConnectionFactory",
topicName="defaultTopic"):
return messaging.JpypePublisher(javaNamingFactory,javaNamingProvider,
connectionFactory,topicName)
## Startup Jpype and import the messaging java package
startJVM("C:\\program files\\Java\\j2re1.4.2_02\\bin\\client\\jvm.dll",
"-Djava.class.path=D:/jIRAD/JpypeJMS/src;D:/jIRAD/JpypeJMS/classes;C:/bea/weblogic81/server/lib/weblogic.jar")
messaging = JPackage('messaging')
# Get a publisher
publisher = pyPublisher()
## Timing test
# The "Start" message signals the subscriber to start timing message receipts
publisher.publish("Start")
t0 = time.time()
for i in range(NUMMSGS):
publisher.publish("Hello World! %s"%i)
print "MessageRate =",float(NUMMSGS)/(time.time()-t0)
# The "Stop" message signals the subscriber to stop timing message receipts
publisher.publish("Stop")
# Close and quit
publisher.close()
shutdownJVM()
from jpype import *
import time
NUMMSGS = 10
def pyPublisher (javaNamingFactory="weblogic.jndi.WLInitialContextFactory",
javaNamingProvider="t3://158.188.40.21:7001",
connectionFactory="weblogic.jms.ConnectionFactory",
topicName="defaultTopic"):
return messaging.JpypePublisher(javaNamingFactory,javaNamingProvider,
connectionFactory,topicName)
## Startup Jpype and import the messaging java package
startJVM("C:\\program files\\Java\\j2re1.4.2_02\\bin\\client\\jvm.dll",
"-Djava.class.path=D:/jIRAD/JpypeJMS/src;D:/jIRAD/JpypeJMS/classes;C:/bea/weblogic81/server/lib/weblogic.jar")
messaging = JPackage('messaging')
# Get a publisher
publisher = pyPublisher()
## Timing test
# The "Start" message signals the subscriber to start timing message receipts
publisher.publish("Start")
t0 = time.time()
for i in range(NUMMSGS):
publisher.publish("Hello World! %s"%i)
print "MessageRate =",float(NUMMSGS)/(time.time()-t0)
# The "Stop" message signals the subscriber to stop timing message receipts
publisher.publish("Stop")
# Close and quit
publisher.close()
shutdownJVM()
@@ -1,42 +1,42 @@
from jpype import *
import time
def pySubscriber (proxy,
javaNamingFactory="weblogic.jndi.WLInitialContextFactory",
javaNamingProvider="t3://158.188.40.21:7001",
connectionFactory="weblogic.jms.ConnectionFactory",
topicName="defaultTopic"):
return messaging.JpypeSubscriber(proxy,javaNamingFactory,javaNamingProvider,
connectionFactory,topicName)
## Startup Jpype and import the messaging java package
startJVM("C:\\program files\\Java\\j2re1.4.2_02\\bin\\client\\jvm.dll",
"-Djava.class.path=D:/jIRAD/JpypeJMS/src;D:/jIRAD/JpypeJMS/classes;C:/bea/weblogic81/server/lib/weblogic.jar")
messaging = JPackage('messaging')
# Setup the JProxy for the messaging.JpypeSubscriberCallback interface
class pyCallback:
startTime = 0
count = 0
def onMessage (self,text):
print text
if text=='Start':
pyCallback.startTime=time.time()
pyCallback.count = 0
elif text=='Stop':
print "Message Rate =",float(pyCallback.count)/(time.time()-pyCallback.startTime)
else:
pyCallback.count += 1
c = pyCallback()
proxy = JProxy(messaging.JpypeSubscriberCallback,inst=c)
# Get a subscriber
sub = pySubscriber(proxy)
print "Listening..."
# Prevent this thread from exiting
time.sleep(1000)
# exit
shutdownJVM()
from jpype import *
import time
def pySubscriber (proxy,
javaNamingFactory="weblogic.jndi.WLInitialContextFactory",
javaNamingProvider="t3://158.188.40.21:7001",
connectionFactory="weblogic.jms.ConnectionFactory",
topicName="defaultTopic"):
return messaging.JpypeSubscriber(proxy,javaNamingFactory,javaNamingProvider,
connectionFactory,topicName)
## Startup Jpype and import the messaging java package
startJVM("C:\\program files\\Java\\j2re1.4.2_02\\bin\\client\\jvm.dll",
"-Djava.class.path=D:/jIRAD/JpypeJMS/src;D:/jIRAD/JpypeJMS/classes;C:/bea/weblogic81/server/lib/weblogic.jar")
messaging = JPackage('messaging')
# Setup the JProxy for the messaging.JpypeSubscriberCallback interface
class pyCallback:
startTime = 0
count = 0
def onMessage (self,text):
print text
if text=='Start':
pyCallback.startTime=time.time()
pyCallback.count = 0
elif text=='Stop':
print "Message Rate =",float(pyCallback.count)/(time.time()-pyCallback.startTime)
else:
pyCallback.count += 1
c = pyCallback()
proxy = JProxy(messaging.JpypeSubscriberCallback,inst=c)
# Get a subscriber
sub = pySubscriber(proxy)
print "Listening..."
# Prevent this thread from exiting
time.sleep(1000)
# exit
shutdownJVM()
@@ -1,20 +1,20 @@
The 2 scripts in this derectory are here to resolve a weakness in the linux implementation.
Since the JVM is loaded dynamically, the LD_LIBRARY_PATH may not contain the proper directories.
Unfortunately, dlopen() will ignore any changes made to the LD_LIBRARY_PATH in the current process.
The jpype.sh is meant as an example for people redistributing apps using jpype. Instead of having
users launch python script.py directly, have then launch script.sh. The companion finjvm.py can be
delivered along your app, but is also present in the ptyhon distribution of jpype.
Developpers are encouraged to make their lives simpler by adding the correct directories to their
LD_LIBRARY_PATH directly.
To learn more about the dlopen problem, you can look at :
http://forum.java.sun.com/thread.jsp?forum=52&thread=303583&message=1210441
and
http://www.nathanr.net/diary/index.php?year=2004&month=05
The 2 scripts in this derectory are here to resolve a weakness in the linux implementation.
Since the JVM is loaded dynamically, the LD_LIBRARY_PATH may not contain the proper directories.
Unfortunately, dlopen() will ignore any changes made to the LD_LIBRARY_PATH in the current process.
The jpype.sh is meant as an example for people redistributing apps using jpype. Instead of having
users launch python script.py directly, have then launch script.sh. The companion finjvm.py can be
delivered along your app, but is also present in the ptyhon distribution of jpype.
Developpers are encouraged to make their lives simpler by adding the correct directories to their
LD_LIBRARY_PATH directly.
To learn more about the dlopen problem, you can look at :
http://forum.java.sun.com/thread.jsp?forum=52&thread=303583&message=1210441
and
http://www.nathanr.net/diary/index.php?year=2004&month=05
@@ -1,20 +1,20 @@
#*****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#*****************************************************************************
import jpype, os.path
jvmlib = jpype.getDefaultJVMPath()
print os.path.dirname(os.path.dirname(jvmlib))
#*****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#*****************************************************************************
import jpype, os.path
jvmlib = jpype.getDefaultJVMPath()
print os.path.dirname(os.path.dirname(jvmlib))
Oops, something went wrong.

0 comments on commit 490eb65

Please sign in to comment.