Changeset 397

Show
Ignore:
Timestamp:
Thu Jan 11 13:24:33 2007
Author:
djfroofy
Message:

- BREAKING more things ;)

Files:

Legend:

Unmodified
Added
Removed
Modified
  • subprojects/JPyper/jpyper/imports.py

    r392 r397  
    4 4     _knee.prefix.require(pfx or 'jre')  
    5 5  
      6 def require_patterns(*patterns):  
      7     """Only do magic import if package name matches one of the given patters. This  
      8     avoids accidental namespace overiding and other weirdness.  
      9     """  
      10     _knee.packagePatterns.require(patterns or [r'^(javax?|com|org|net|edu)\..*'])  
      11  
  • subprojects/JPyper/jpyper/__init__.py

    r393 r397  
    1   import jpype as jp  
    2   from jpyper.utils import *  
    3   import os, sys  
    4 1  
      2 from jpype import JPackage  
    5 3  
    6   __all__ = ['JAVA_HOME', 'JVMLIB', 'CLASSPATH', 'packages', 'jimport']  
      4 __author__ = 'Drew Smathers'  
      5 __revision__ = '$Revision$'  
    7 6  
    8   env = os.environ.get  
    9   _iswin = sys.platform in ('win32', 'nt')  
    10 7  
    11   JAVA_HOME = env('JAVA_HOME')  
      8 #class PackageIntrospecter(object):  
      9 #    def __getattr__(self, name):  
      10 #        return JPackage(name)  
      11      
      12 #packageIntrospecter = PackageIntrospecter()  
      13  
      14 def jimport(path):  
      15     tks = path.split('.')  
      16     base = tks[0]  
      17     pth = tks[1:]  
      18     package = next = JPackage(base)  
      19     for elm in pth:  
      20         next = getattr(next, elm)  
      21     return next  
    12 22  
    13   if not JAVA_HOME:  
    14       raise RuntimeError, 'Environment variable JAVA_HOME not defined'  
    15    
    16   JVMLIB = os.path.sep.join([JAVA_HOME] + 'jre/lib/i386/client/libjvm'.split('/'))  
    17   _dllext = ('.so', '.dll')[_iswin]  
    18   JVMLIB += _dllext  
    19   #print JVMLIB  
    20    
    21   CLASSPATH = env('CLASSPATH')  
    22    
    23   jp.startJVM(JVMLIB, '-Djava.class.path=%s' % CLASSPATH)  
    24 23