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/05 00:16:31 UTC
svn commit: r1240638 - in /lucene/pylucene/trunk/jcc: CHANGES jcc/cpp.py
Author: vajda
Date: Sat Feb 4 23:16:30 2012
New Revision: 1240638
URL: http://svn.apache.org/viewvc?rev=1240638&view=rev
Log:
- added check for duplicate class names in generated Python module
Modified:
lucene/pylucene/trunk/jcc/CHANGES
lucene/pylucene/trunk/jcc/jcc/cpp.py
Modified: lucene/pylucene/trunk/jcc/CHANGES
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/CHANGES?rev=1240638&r1=1240637&r2=1240638&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/CHANGES (original)
+++ lucene/pylucene/trunk/jcc/CHANGES Sat Feb 4 23:16:30 2012
@@ -2,7 +2,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)
- -
+ - added check for duplicate class names in generated Python module
+ -
Version 2.11 -> 2.12
--------------------
Modified: lucene/pylucene/trunk/jcc/jcc/cpp.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/jcc/jcc/cpp.py?rev=1240638&r1=1240637&r2=1240638&view=diff
==============================================================================
--- lucene/pylucene/trunk/jcc/jcc/cpp.py (original)
+++ lucene/pylucene/trunk/jcc/jcc/cpp.py Sat Feb 4 23:16:30 2012
@@ -594,8 +594,16 @@ def jcc(args):
out_cpp = file(os.path.join(cppdir, fileName), 'w')
done = set()
+ pythonNames = {}
for importset in imports.itervalues():
done.update(importset)
+ if moduleName:
+ for cls in importset:
+ name = cls.getName().split_pkg('.')[-1]
+ if name in pythonNames:
+ raise ValueError, (cls, 'python class name already in use, use --rename', name, pythonNames[name])
+ else:
+ pythonNames[name] = cls
todo = typeset - done
if allInOne and wrapperFiles > 1:
@@ -628,6 +636,11 @@ def jcc(args):
methodNames, fields, instanceFields,
declares, typeset)
if moduleName:
+ name = renames.get(className) or names[-1]
+ if name in pythonNames:
+ raise ValueError, (cls, 'python class name already in use, use --rename', name, pythonNames[name])
+ else:
+ pythonNames[name] = cls
python(env, out_h, out_cpp,
cls, superCls, names, superNames,
constructors, methods, protectedMethods,