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 2010/04/23 01:38:29 UTC

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

Author: vajda
Date: Thu Apr 22 23:38:28 2010
New Revision: 937107

URL: http://svn.apache.org/viewvc?rev=937107&view=rev
Log:
 - added support for --resources

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
    lucene/pylucene/trunk/jcc/setup.py

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=937107&r1=937106&r2=937107&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Thu Apr 22 23:38:28 2010
@@ -16,6 +16,7 @@ Version 2.5 ->
  - added support for auto-boxing Number from python int, long and float
  - added 'asm' to list of reserved words
  - added JCC_VERSION string to modules using JCC
+ - added support for --resources
  - 
 
 Version 2.4 -> 2.5

Modified: lucene/pylucene/trunk/jcc/jcc/__main__.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/__main__.py?rev=937107&r1=937106&r2=937107&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/__main__.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/__main__.py Thu Apr 22 23:38:28 2010
@@ -32,6 +32,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
+    --resources             - include resource directory in distribution as
+                              package data
 
   Python wrapper generation options:
     --python NAME           - generate wrappers for use from Python in a module

Modified: lucene/pylucene/trunk/jcc/jcc/cpp.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/cpp.py?rev=937107&r1=937106&r2=937107&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/cpp.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/cpp.py Thu Apr 22 23:38:28 2010
@@ -317,6 +317,7 @@ def jcc(args):
     compiler = None
     generics = hasattr(_jcc, "Type")
     arch = []
+    resources = []
 
     i = 1
     while i < len(args):
@@ -421,6 +422,9 @@ def jcc(args):
                 generics = False
             elif arg == '--find-jvm-dll':
                 find_jvm_dll = True
+            elif arg == '--resources':
+                i += 1
+                resources.append(args[i])
             else:
                 raise ValueError, "Invalid argument: %s" %(arg)
         else:
@@ -444,7 +448,7 @@ 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)
+                    arch, generics, resources)
     else:
         for className in classNames:
             if className in excludes:
@@ -565,7 +569,7 @@ 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)
+                        arch, generics, resources)
 
 
 def header(env, out, cls, typeset, packages, excludes, generics):

Modified: lucene/pylucene/trunk/jcc/jcc/python.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/python.py?rev=937107&r1=937106&r2=937107&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/python.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/python.py Thu Apr 22 23:38:28 2010
@@ -1512,7 +1512,8 @@ def module(out, allInOne, classes, cppdi
 
 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):
+            shared, compiler, modules, wininst, find_jvm_dll, arch, generics,
+            resources):
 
     try:
         if use_distutils:
@@ -1556,6 +1557,25 @@ def compile(env, jccPath, output, module
     for jar in jars:
         shutil.copy2(jar, modulePath)
         package_data.append(os.path.basename(jar))
+    if resources:
+        def copytree(src, dst):
+            _dst = os.path.join(modulePath, dst)
+            if not os.path.exists(_dst):
+                os.mkdir(_dst)
+            for name in os.listdir(src):
+                if name.startswith('.'):
+                    continue
+                _src = os.path.join(src, name)
+                if os.path.islink(_src):
+                    continue
+                _dst = os.path.join(dst, name)
+                if os.path.isdir(_src):
+                    copytree(_src, _dst)
+                else:
+                    shutil.copy2(_src, os.path.join(modulePath, _dst))
+                    package_data.append(_dst)
+        for resource in resources:
+            copytree(resource, os.path.split(resource)[-1])
 
     packages = [moduleName]
     if modules:

Modified: lucene/pylucene/trunk/jcc/setup.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/setup.py?rev=937107&r1=937106&r2=937107&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/setup.py (original)
+++ lucene/pylucene/trunk/jcc/setup.py Thu Apr 22 23:38:28 2010
@@ -12,7 +12,7 @@
 
 import os, sys, platform, subprocess
 
-jcc_ver = '2.5'
+jcc_ver = '2.6'
 machine = platform.machine()
 
 if machine.startswith("iPod") or machine.startswith("iPhone"):