Skip to content
Permalink
Browse files

Reorganization (#334)

* Completion of reorg.
* Squash CI porting work.
* Fix exception
* Applied autopep8
  • Loading branch information...
Thrameos committed Aug 8, 2018
1 parent 490eb65 commit a36f8922d9bc286221325d122a2e9b2bee1191f6
Showing with 13,989 additions and 11,775 deletions.
  1. +1 −0 .gitattributes
  2. +10 −0 .gitignore
  3. +471 −0 doc/ChangeLog-0.7.md
  4. +20 −12 jpype/__init__.py
  5. +37 −32 jpype/_classpath.py
  6. +76 −57 jpype/_core.py
  7. +20 −15 jpype/_cygwin.py
  8. +9 −5 jpype/_darwin.py
  9. +12 −5 jpype/_gui.py
  10. +141 −110 jpype/_jarray.py
  11. +146 −89 jpype/_jboxed.py
  12. +272 −233 jpype/_jclass.py
  13. +43 −15 jpype/_jcollection.py
  14. +32 −0 jpype/_jcomparable.py
  15. +84 −0 jpype/_jcustomizer.py
  16. +58 −37 jpype/_jexception.py
  17. +18 −10 jpype/{_refdaemon.py → _jinit.py}
  18. +14 −8 jpype/_jio.py
  19. +161 −12 jpype/_jobject.py
  20. +13 −11 jpype/_jpackage.py
  21. +29 −32 jpype/_jproxy.py
  22. +81 −0 jpype/_jstring.py
  23. +155 −0 jpype/_jtypes.py
  24. +8 −8 jpype/_jvmfinder.py
  25. +0 −105 jpype/_jwrapper.py
  26. +4 −2 jpype/_linux.py
  27. +24 −17 jpype/_properties.py
  28. +12 −3 jpype/_pykeywords.py
  29. +22 −19 jpype/_windows.py
  30. +104 −64 jpype/imports.py
  31. +10 −8 jpype/nio.py
  32. +17 −5 jpype/reflect.py
  33. +24 −7 jpype/{JClassUtil.py → types.py}
  34. +20 −27 native/common/include/jp_array.h
  35. +30 −16 native/common/include/jp_arrayclass.h
  36. +59 −0 native/common/include/jp_baseclasses.h
  37. +34 −37 native/common/include/jp_booleantype.h
  38. +106 −0 native/common/include/jp_boxedclasses.h
  39. +48 −45 native/common/include/jp_bytetype.h
  40. +34 −41 native/common/include/jp_chartype.h
  41. +143 −82 native/common/include/jp_class.h
  42. +100 −0 native/common/include/jp_class2.h
  43. +0 −50 native/common/include/jp_classbase.h
  44. +34 −37 native/common/include/jp_doubletype.h
  45. +50 −0 native/common/include/jp_encoding.h
  46. +20 −40 native/common/include/jp_env.h
  47. +146 −71 native/common/include/jp_exception.h
  48. +33 −35 native/common/include/jp_field.h
  49. +34 −38 native/common/include/jp_floattype.h
  50. +3 −129 native/common/include/jp_hostenv.h
  51. +41 −38 native/common/include/jp_inttype.h
  52. +180 −113 native/common/include/jp_javaframe.h
  53. +103 −96 native/common/include/jp_jniutil.h
  54. +34 −39 native/common/include/jp_longtype.h
  55. +41 −38 native/common/include/jp_method.h
  56. +98 −34 native/common/include/jp_methodoverload.h
  57. +11 −9 native/common/include/jp_monitor.h
  58. +0 −48 native/common/include/jp_object.h
  59. +0 −27 native/common/include/jp_objectbase.h
  60. +0 −105 native/common/include/jp_objecttypes.h
  61. +15 −13 native/common/include/jp_platform_linux.h
  62. +21 −20 native/common/include/jp_platform_win32.h
  63. +53 −51 native/common/include/jp_primitive_common.h
  64. +17 −39 native/common/include/jp_primitivetype.h
  65. +13 −12 native/common/include/jp_proxy.h
  66. +7 −5 native/common/include/jp_reference_queue.h
  67. +46 −43 native/common/include/jp_shorttype.h
  68. +15 −21 native/common/include/{jp_jcharstring.h → jp_stringclass.h}
  69. +64 −67 native/common/include/jp_tracer.h
  70. +0 −90 native/common/include/jp_type.h
  71. +37 −17 native/common/include/jp_typemanager.h
  72. +4 −104 native/common/include/jp_typename.h
  73. +68 −0 native/common/include/jp_value.h
  74. +27 −42 native/common/include/jp_voidtype.h
  75. +86 −54 native/common/include/jpype.h
  76. +77 −89 native/common/jp_array.cpp
  77. +100 −115 native/common/jp_arrayclass.cpp
  78. +246 −0 native/common/jp_baseclasses.cpp
  79. +103 −93 native/common/jp_booleantype.cpp
  80. +190 −0 native/common/jp_boxedclasses.cpp
  81. +119 −120 native/common/jp_bytetype.cpp
  82. +116 −114 native/common/jp_chartype.cpp
  83. +386 −464 native/common/jp_class.cpp
  84. +0 −74 native/common/jp_cleaner.cpp
  85. +105 −96 native/common/jp_doubletype.cpp
  86. +237 −0 native/common/jp_encoding.cpp
  87. +330 −392 native/common/jp_env.cpp
  88. +381 −0 native/common/jp_exception.cpp
  89. +57 −82 native/common/jp_field.cpp
  90. +118 −107 native/common/jp_floattype.cpp
  91. +0 −71 native/common/jp_hostref.cpp
  92. +107 −104 native/common/jp_inttype.cpp
  93. +0 −69 native/common/jp_jcharstring.cpp
  94. +380 −362 native/common/jp_jniutil.cpp
  95. +111 −103 native/common/jp_longtype.cpp
  96. +207 −193 native/common/jp_method.cpp
  97. +213 −262 native/common/jp_methodoverload.cpp
  98. +24 −13 native/common/jp_monitor.cpp
  99. +0 −110 native/common/jp_object.cpp
  100. +0 −209 native/common/jp_objecttype.cpp
  101. +0 −26 native/common/jp_platform_linux.cpp
  102. +0 −25 native/common/jp_platform_win32.cpp
  103. +39 −0 native/common/jp_primitivetype.cpp
  104. +65 −122 native/common/jp_proxy.cpp
  105. +51 −57 native/common/jp_reference_queue.cpp
  106. +107 −104 native/common/jp_shorttype.cpp
  107. +121 −0 native/common/jp_stringclass.cpp
  108. +0 −144 native/common/jp_stringtype.cpp
  109. +63 −40 native/common/jp_tracer.cpp
  110. +155 −111 native/common/jp_typemanager.cpp
  111. +0 −159 native/common/jp_typename.cpp
  112. +12 −10 native/common/{jp_classbase.cpp → jp_value.cpp}
  113. +49 −40 native/common/jp_voidtype.cpp
  114. +0 −140 native/python/include/capsulethunk.h
  115. +0 −2 native/python/include/jp_cocoatools.h
  116. +69 −0 native/python/include/jp_pythonenv.h
  117. +578 −0 native/python/include/jp_pythontypes.h
  118. +0 −18 native/python/include/jp_runloopstopper.h
  119. +39 −22 native/python/include/jpype_memory_view.h
  120. +0 −104 native/python/include/jpype_python.h
  121. +0 −58 native/python/include/py_class.h
  122. +0 −41 native/python/include/py_field.h
  123. +0 −245 native/python/include/py_hostenv.h
  124. +0 −56 native/python/include/py_method.h
  125. +37 −0 native/python/include/pyjp.h
  126. +50 −0 native/python/include/pyjp_array.h
  127. +74 −0 native/python/include/pyjp_class.h
  128. +40 −0 native/python/include/pyjp_field.h
  129. +47 −0 native/python/include/pyjp_method.h
  130. +48 −0 native/python/include/pyjp_module.h
  131. +16 −12 native/python/include/{py_monitor.h → pyjp_monitor.h}
  132. +39 −0 native/python/include/pyjp_proxy.h
  133. +42 −0 native/python/include/pyjp_value.h
  134. +0 −261 native/python/include/pythonenv.h
  135. +167 −0 native/python/jp_pythonenv.cpp
  136. +762 −0 native/python/jp_pythontypes.cpp
  137. +0 −246 native/python/jpype_javaarray.cpp
  138. +0 −51 native/python/jpype_javaclass.cpp
  139. +0 −59 native/python/jpype_javanio.cpp
  140. +239 −236 native/python/jpype_memory_view.cpp
  141. +0 −359 native/python/jpype_module.cpp
  142. +0 −231 native/python/jpype_python.cpp
  143. +0 −397 native/python/py_class.cpp
  144. +0 −222 native/python/py_field.cpp
  145. +0 −654 native/python/py_hostenv.cpp
  146. +0 −405 native/python/py_method.cpp
  147. +0 −103 native/python/py_monitor.cpp
  148. +276 −0 native/python/pyjp_array.cpp
  149. +394 −0 native/python/pyjp_class.cpp
  150. +175 −0 native/python/pyjp_field.cpp
  151. +251 −0 native/python/pyjp_method.cpp
  152. +345 −0 native/python/pyjp_module.cpp
  153. +143 −0 native/python/pyjp_monitor.cpp
  154. +167 −0 native/python/pyjp_proxy.cpp
  155. +240 −0 native/python/pyjp_value.cpp
  156. +0 −562 native/python/pythonenv.cpp
  157. +3 −0 project/README.md
  158. +561 −0 project/jpype_cpython/nbproject/configurations.xml
  159. +2 −0 project/jpype_cpython/nbproject/project.properties
  160. +27 −0 project/jpype_cpython/nbproject/project.xml
  161. +68 −0 project/jpype_java/build.xml
  162. +75 −0 project/jpype_java/nbproject/project.properties
  163. +15 −0 project/jpype_java/nbproject/project.xml
  164. +2 −2 setup.py
  165. +30 −22 setupext/build_ext.py
  166. +19 −18 setupext/build_java.py
  167. +84 −77 setupext/build_thunk.py
  168. +9 −6 setupext/dist.py
  169. +13 −8 setupext/platform.py
  170. +17 −17 setupext/test_java.py
  171. +2 −1 setupext/utils.py
  172. +6 −6 test/harness/jpype/attr/Test1.java
  173. +3 −1 test/harness/jpype/exc/ExceptionTest.java
  174. +9 −7 test/jpypetest/__init__.py
  175. +29 −19 test/jpypetest/array.py
  176. +63 −52 test/jpypetest/attr.py
  177. +58 −52 test/jpypetest/boxed.py
  178. +16 −13 test/jpypetest/closeable.py
  179. +5 −5 test/jpypetest/closed.py
  180. +7 −6 test/jpypetest/collection.py
  181. +4 −4 test/jpypetest/common.py
  182. +19 −16 test/jpypetest/exc.py
  183. +7 −6 test/jpypetest/forname.py
  184. +8 −6 test/jpypetest/imports.py
  185. +4 −2 test/jpypetest/jvmfinder.py
  186. +49 −16 test/jpypetest/leak.py
  187. +3 −2 test/jpypetest/mro.py
  188. +22 −19 test/jpypetest/numeric.py
  189. +55 −10 test/jpypetest/objectwrapper.py
  190. +64 −40 test/jpypetest/overloads.py
  191. +23 −2 test/jpypetest/properties.py
  192. +11 −5 test/jpypetest/proxy.py
  193. +15 −14 test/jpypetest/proxy_multithreaded.py
  194. +9 −5 test/jpypetest/reflect.py
  195. +5 −5 test/jpypetest/serial.py
  196. +8 −6 test/jpypetest/startup.py
  197. +16 −16 test/jpypetest/values.py
  198. +33 −30 test/jpypetest/varargs.py
  199. +1 −1 test/testsuite.py
@@ -7,6 +7,7 @@
*.h text eol=lf

*.xml text eol=lf
*.md text
*.txt text
.gitignore text eol=lf
.gitattributes text eol=lf
10 .gitignore 100644 → 100755
@@ -49,3 +49,13 @@ coverage.xml
docs/_build/
# PyBuilder
target/
/project/jpype_java/nbproject/private/
/project/jpype_cpython/nbproject/private/
/project/jpype_cpython/nbproject/Makefile*
/project/jpype_java/nbproject/build-impl.xml
/project/jpype_java/nbproject/genfiles.properties
/project/jpype_java/dist
/project/jpype_java/build
/project/jpype_cpython/Makefile
/project/jpype_cpython/nbproject/Package-Release.bash
/project/jpype_python/nbproject/private/

Large diffs are not rendered by default.

@@ -1,4 +1,4 @@
#*****************************************************************************
# *****************************************************************************
# Copyright 2004-2008 Steve Menard
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,30 +13,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
#*****************************************************************************
# *****************************************************************************
from ._jpackage import *
from ._jclass import *
from ._jarray import *
from ._jwrapper import *
from ._jproxy import *
from ._jexception import *
from ._jboxed import *
from ._core import *
from ._gui import *
from ._classpath import *
from .types import *
from . import reflect
from . import nio
from . import types

from . import JClassUtil

# Support for isinstance(obj, )
from ._jclass import _JavaObject as JavaObject
from ._jclass import _JavaClass as JavaClass
__all__ = ['java', 'javax', 'JIterator', 'JException']
__all__.extend(_core.__all__)
__all__.extend(_classpath.__all__)
__all__.extend(types.__all__)
__all__.extend(_jproxy.__all__)
__all__.extend(_jpackage.__all__)
__all__.extend(_gui.__all__)

__version_info__ = (0, 6, 3)
__version_info__ = (0, 7, 0)
__version__ = ".".join(str(i) for i in __version_info__)


@_core.deprecated
def JIterator(it):
"""Deprecated"""
return it


# FIXME these should be deprecated. The old JPackage system is only for
# python2 series and generates lots of deceptive classes. At some point
# these two are going to have to go away.
java = JPackage("java")
javax = JPackage("javax")
@@ -2,85 +2,90 @@
import sys as _sys
import glob as _glob

__all__=['addClassPath', 'getClassPath']
__all__ = ['addClassPath', 'getClassPath']

_CLASSPATHS=set()
_CLASSPATHS = set()
_SEP = _os.path.pathsep
if _sys.platform=='cygwin':
_SEP=';'
if _sys.platform == 'cygwin':
_SEP = ';'


def _init():
global _CLASSPATHS
global _SEP
classpath=_os.environ.get("CLASSPATH")
classpath = _os.environ.get("CLASSPATH")
if classpath:
_CLASSPATHS|=set(classpath.split(_SEP))
_CLASSPATHS |= set(classpath.split(_SEP))


_init()

# Cygwin needs to convert to windows paths
if _sys.platform=='cygwin':
_root=None
if _sys.platform == 'cygwin':
_root = None

def _get_root():
global _root
if _root!=None:
if _root != None:
return _root
import subprocess
proc = subprocess.Popen("cygpath -wa /", shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, close_fds=True)
_root=proc.stdout.read().strip().decode('utf-8')
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, close_fds=True)
_root = proc.stdout.read().strip().decode('utf-8')
return _root

def _splitpath(path):
parts=[]
(path, tail)=_os.path.split( path)
parts = []
(path, tail) = _os.path.split(path)
while path and tail:
parts.insert(0,tail)
(path,tail)=_os.path.split(path)
parts.insert(0, tail)
(path, tail) = _os.path.split(path)
return parts

def _posix2win(directory):
root=_get_root()
directory=_os.path.abspath(directory)
paths=_splitpath(directory)
if paths[0]=="cygdrive":
root = _get_root()
directory = _os.path.abspath(directory)
paths = _splitpath(directory)
if paths[0] == "cygdrive":
paths.pop(0)
drive=paths.pop(0)
paths.insert(0, "%s:"%drive)
drive = paths.pop(0)
paths.insert(0, "%s:" % drive)
return '\\'.join(paths)
paths.insert(0,root)
paths.insert(0, root)
return '\\'.join(paths)
# needed for testing
__all__.append("_posix2win")


def addClassPath(path1):
""" Add a path to the java class path"""
global _CLASSPATHS
path1=_os.path.abspath(path1)
if _sys.platform=='cygwin':
path1=_posix2win(path1)
path1 = _os.path.abspath(path1)
if _sys.platform == 'cygwin':
path1 = _posix2win(path1)
_CLASSPATHS.add(str(path1))


def getClassPath():
""" Get the full java class path.
Includes user added paths and the environment CLASSPATH.
"""
global _CLASSPATHS
global _SEP
out=[]
out = []
for path in _CLASSPATHS:
if path=='':
if path == '':
continue
if path.endswith('*'):
paths=_glob.glob(path+".jar")
if len(path)==0:
continue
paths = _glob.glob(path+".jar")
if len(path) == 0:
continue
out.extend(paths)
else:
out.append(path)
return _SEP.join(out)


#print(getClassPath())
# print(getClassPath())

0 comments on commit a36f892

Please sign in to comment.
You can’t perform that action at this time.