Author: vajda
Date: Fri Nov 27 20:09:08 2020
New Revision: 1883878

URL: http://svn.apache.org/viewvc?rev=1883878&view=rev
Log:
fixed bug with --import support using python2's os.path.walk() from python3

Modified:
    lucene/pylucene/trunk/jcc/CHANGES
    lucene/pylucene/trunk/jcc/jcc3/cpp.py

Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: 
http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=1883878&r1=1883877&r2=1883878&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Fri Nov 27 20:09:08 2020
@@ -1,3 +1,8 @@
+Version 3.8 ->
+--------------
+ - fixed bug with --import support using python2's os.path.walk() from python3
+ - 
+
 Version 3.7 -> 3.8
 ------------------
  - added support for building wheels via --wheel flag (Chee Yong Teh)

Modified: lucene/pylucene/trunk/jcc/jcc3/cpp.py
URL: 
http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc3/cpp.py?rev=1883878&r1=1883877&r2=1883878&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc3/cpp.py (original)
+++ lucene/pylucene/trunk/jcc/jcc3/cpp.py Fri Nov 27 20:09:08 2020
@@ -597,17 +597,20 @@ def jcc(args):
     initvm_args['maxstack'] = '512k'
     initvm_args['vmargs'] = vmargs
 
-    env = initVM(os.pathsep.join(classpath) or None, **initvm_args)
-
-    typeset = set()
-    excludes = set(excludes)
-
     if imports:
         if shared:
             imports = dict((__import__(import_), set()) for import_ in imports)
         else:
             raise ValueError("--shared must be used when using --import")
 
+        for import_ in imports.keys():
+            classpath.append(import_.CLASSPATH)
+
+    env = initVM(os.pathsep.join(classpath) or None, **initvm_args)
+
+    typeset = set()
+    excludes = set(excludes)
+
     if recompile or not build and (install or dist or egg_info):
         if moduleName is None:
             raise ValueError('module name not specified (use --python)')
@@ -620,19 +623,16 @@ def jcc(args):
                     egg_info, extra_setup_args)
     else:
         if imports:
-            def walk(args, dirname, names):
-                (include, importset) = args
-                for name in names:
-                    if name.endswith('.h'):
-                        className = os.path.join(dirname[len(include) + 1:],
-                                                 name[:-2])
-                        if os.path.sep != '/':
-                            className = className.replace(os.path.sep, '/')
-                        importset.add(findClass(className))
             for import_, importset in imports.items():
-                env._addClassPath(import_.CLASSPATH)
                 include = os.path.join(import_.__module_dir__, 'include')
-                os.path.walk(include, walk, (include, importset))
+                for dirpath, dirnames, filenames in os.walk(include):
+                    for name in filenames:
+                        if name.endswith('.h'):
+                            className = os.path.join(dirpath[len(include) + 
1:],
+                                                     name[:-2])
+                            if os.path.sep != '/':
+                                className = className.replace(os.path.sep, '/')
+                            importset.add(findClass(className))
                 typeset.update(importset)
         typeset.add(findClass('java/lang/Object'))
         typeset.add(findClass('java/lang/Class'))


Reply via email to