You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-commits@lucene.apache.org by va...@apache.org on 2012/02/04 23:11:10 UTC

svn commit: r1240624 - in /lucene/pylucene/trunk/jcc: CHANGES jcc/__main__.py jcc/cpp.py jcc/python.py

Author: vajda
Date: Sat Feb  4 22:11:05 2012
New Revision: 1240624

URL: http://svn.apache.org/viewvc?rev=1240624&view=rev
Log:
 - added --maxheap, --egg-info and --extra-setup-arg parameters (Chris Wilson)

Modified:
    lucene/pylucene/trunk/jcc/CHANGES
    lucene/pylucene/trunk/jcc/jcc/__main__.py
    lucene/pylucene/trunk/jcc/jcc/cpp.py
    lucene/pylucene/trunk/jcc/jcc/python.py

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=1240624&r1=1240623&r2=1240624&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Sat Feb  4 22:11:05 2012
@@ -1,7 +1,8 @@
 Version 2.12 ->
 ---------------
  - fixed bug with name collision between method and static field of same name
- - 
+ - added --maxheap, --egg-info and --extra-setup-arg parameters (Chris Wilson)
+ -
 
 Version 2.11 -> 2.12
 --------------------

Modified: lucene/pylucene/trunk/jcc/jcc/__main__.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/__main__.py?rev=1240624&r1=1240623&r2=1240624&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/__main__.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/__main__.py Sat Feb  4 22:11:05 2012
@@ -31,6 +31,8 @@ if len(sys.argv) == 1 or '--help' in sys
                               clashes with C/C++ reserved words or header
                               file definitions
     --vmarg                 - add extra Java VM initialization parameter
+    --maxheap               - set the maximum Java heap size, as passing -Xmx*
+                              using --vmarg doesn't do anything
     --resources             - include resource directory in distribution as
                               package data
 
@@ -77,6 +79,8 @@ if len(sys.argv) == 1 or '--help' in sys
     --build                 - generate the wrapper and compile it
     --compile               - recompile the (previously generated) module
     --install               - install the wrapper in the local site-packages
+    --egg-info              - ask distutils setup() to generate egg info, and
+                              don't compile the module (for pip install)
 
   Distribution actions:
     --use-distutils         - use distutils even when setuptools is available
@@ -91,6 +95,8 @@ if len(sys.argv) == 1 or '--help' in sys
     --install-dir INSTALLDIR
     --prefix PREFIX
     --home HOMEDIR
+    --extra-setup-arg       - pass an extra argument on setup.py command line
+                              (pip install uses --egg-base and --record params)
 '''
     print help
     sys.exit(0)

Modified: lucene/pylucene/trunk/jcc/jcc/cpp.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/cpp.py?rev=1240624&r1=1240623&r2=1240624&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/cpp.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/cpp.py Sat Feb  4 22:11:05 2012
@@ -349,6 +349,7 @@ def jcc(args):
     build = False
     install = False
     recompile = False
+    egg_info = False
     output = 'build'
     debug = False
     excludes = []
@@ -372,7 +373,9 @@ def jcc(args):
     arch = []
     resources = []
     imports = {}
-
+    extra_setup_args = []
+    initvm_args = {}
+    
     i = 1
     while i < len(args):
         arg = args[i]
@@ -398,6 +401,9 @@ def jcc(args):
             elif arg == '--vmarg':
                 i += 1
                 vmargs.append(args[i])
+            elif arg == '--maxheap':
+                i += 1
+                initvm_args['maxheap'] = args[i]
             elif arg == '--python':
                 from python import python, module
                 i += 1
@@ -414,6 +420,12 @@ def jcc(args):
             elif arg == '--compile':
                 from python import compile
                 recompile = True
+            elif arg == '--egg-info':
+                from python import compile
+                egg_info = True
+            elif arg == '--extra-setup-arg':
+                i += 1
+                extra_setup_args.append(args[i])
             elif arg == '--output':
                 i += 1
                 output = args[i]
@@ -492,8 +504,10 @@ def jcc(args):
     if libpath:
         vmargs.append('-Djava.library.path=' + os.pathsep.join(libpath))
 
-    env = initVM(os.pathsep.join(classpath) or None,
-                 maxstack='512k', vmargs=' '.join(vmargs))
+    initvm_args['maxstack'] = '512k'
+    initvm_args['vmargs'] = ' '.join(vmargs)
+
+    env = initVM(os.pathsep.join(classpath) or None, **initvm_args)
 
     typeset = set()
     excludes = set(excludes)
@@ -504,7 +518,7 @@ def jcc(args):
         else:
             raise ValueError, "--shared must be used when using --import"
 
-    if recompile or not build and (install or dist):
+    if recompile or not build and (install or dist or egg_info):
         if moduleName is None:
             raise ValueError, 'module name not specified (use --python)'
         else:
@@ -512,7 +526,8 @@ def jcc(args):
                     install, dist, debug, jars, version,
                     prefix, root, install_dir, home_dir, use_distutils,
                     shared, compiler, modules, wininst, find_jvm_dll,
-                    arch, generics, resources, imports)
+                    arch, generics, resources, imports, egg_info,
+                    extra_setup_args)
     else:
         if imports:
             def walk((include, importset), dirname, names):
@@ -647,12 +662,13 @@ def jcc(args):
             module(out, allInOne, done, imports, cppdir, moduleName,
                    shared, generics)
             out.close()
-            if build or install or dist:
+            if build or install or dist or egg_info:
                 compile(env, os.path.dirname(args[0]), output, moduleName,
                         install, dist, debug, jars, version,
                         prefix, root, install_dir, home_dir, use_distutils,
                         shared, compiler, modules, wininst, find_jvm_dll,
-                        arch, generics, resources, imports)
+                        arch, generics, resources, imports, egg_info,
+                        extra_setup_args)
 
 
 def header(env, out, cls, typeset, packages, excludes, generics, _dll_export):

Modified: lucene/pylucene/trunk/jcc/jcc/python.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/python.py?rev=1240624&r1=1240623&r2=1240624&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/python.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/python.py Sat Feb  4 22:11:05 2012
@@ -1563,7 +1563,7 @@ def module(out, allInOne, classes, impor
 def compile(env, jccPath, output, moduleName, install, dist, debug, jars,
             version, prefix, root, install_dir, home_dir, use_distutils,
             shared, compiler, modules, wininst, find_jvm_dll, arch, generics,
-            resources, imports):
+            resources, imports, egg_info, extra_setup_args):
 
     try:
         if use_distutils:
@@ -1730,7 +1730,10 @@ def compile(env, jccPath, output, module
             if name.endswith('.cpp'):
                 sources.append(os.path.join(path, name))
 
-    script_args = ['build_ext']
+    if egg_info:
+        script_args = ['egg_info']
+    else:    
+        script_args = ['build_ext']
 
     includes[0:0] = INCLUDES
     compile_args = CFLAGS
@@ -1840,6 +1843,7 @@ def compile(env, jccPath, output, module
         config_vars['CFLAGS'] = ' '.join(cflags)
 
     extensions = [Extension('.'.join([moduleName, extname]), **args)]
+    script_args.extend(extra_setup_args)
 
     args = {
         'name': moduleName,
@@ -1853,4 +1857,6 @@ def compile(env, jccPath, output, module
     if with_setuptools:
         args['zip_safe'] = False
 
+    print "setup args = %s" % args
+
     setup(**args)