Move 2.0 changes collected in branches/pending back to trunk for further
[scons.git] / src / engine / SCons / Tool / javac.py
index 78d641a522b2f181c2958b3319dcc1d0607753c5..d080af5f10120b02fefe31fa5c726eb2b95027d3 100644 (file)
@@ -30,12 +30,12 @@ selection method.
 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #
+from __future__ import generators  ### KEEP FOR COMPATIBILITY FIXERS
 
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
 import os
 import os.path
-import string
 
 import SCons.Action
 import SCons.Builder
@@ -45,7 +45,7 @@ import SCons.Util
 
 def classname(path):
     """Turn a string (path name) into a Java class name."""
-    return string.replace(os.path.normpath(path), os.sep, '.')
+    return os.path.normpath(path).replace(os.sep, '.')
 
 def emit_java_classes(target, source, env):
     """Create and return lists of source java files
@@ -67,20 +67,19 @@ def emit_java_classes(target, source, env):
 
     slist = []
     js = _my_normcase(java_suffix)
-    find_java = lambda n, js=js, ljs=len(js): _my_normcase(n[-ljs:]) == js
     for entry in source:
         entry = entry.rentry().disambiguate()
         if isinstance(entry, SCons.Node.FS.File):
             slist.append(entry)
         elif isinstance(entry, SCons.Node.FS.Dir):
             result = SCons.Util.OrderedDict()
-            def visit(arg, dirname, names, fj=find_java, dirnode=entry.rdir()):
-                java_files = filter(fj, names)
+            def visit(arg, dirname, names, dirnode=entry.rdir()):
+                java_files = [n for n in names if _my_normcase(n[-len(js):]) == js]
                 # The on-disk entries come back in arbitrary order.  Sort
                 # them so our target and source lists are determinate.
                 java_files.sort()
                 mydir = dirnode.Dir(dirname)
-                java_paths = map(lambda f, d=mydir: d.File(f), java_files)
+                java_paths = [mydir.File(f) for f in java_files]
                 for jp in java_paths:
                      arg[jp] = True
 
@@ -156,8 +155,8 @@ class pathopt:
         if self.default:
             path = path + [ env[self.default] ]
         if path:
-            return [self.opt, string.join(path, os.pathsep)]
-            #return self.opt + " " + string.join(path, os.pathsep)
+            return [self.opt, os.pathsep.join(path)]
+            #return self.opt + " " + os.pathsep.join(path)
         else:
             return []
             #return ""
@@ -194,7 +193,7 @@ def Java(env, target, source, *args, **kw):
                 b = env.JavaClassFile
             else:
                 b = env.JavaClassDir
-        result.extend(apply(b, (t, s) + args, kw))
+        result.extend(b(t, s, *args, **kw))
 
     return result