@@ -168,7 +168,7 @@ object SparkBuild extends PomBuild {
168168 /* Enable Assembly for all assembly projects */
169169 assemblyProjects.foreach(enable(Assembly .settings))
170170
171- /* Package pyspark artifacts in the main assembly . */
171+ /* Package pyspark artifacts in a separate zip file for YARN . */
172172 enable(PySparkAssembly .settings)(assembly)
173173
174174 /* Enable unidoc only for the root spark project */
@@ -373,7 +373,6 @@ object PySparkAssembly {
373373 import java .util .zip .{ZipOutputStream , ZipEntry }
374374
375375 lazy val settings = Seq (
376- unmanagedJars in Compile += { BuildCommons .sparkHome / " python/lib/py4j-0.8.2.1-src.zip" },
377376 // Use a resource generator to copy all .py files from python/pyspark into a managed directory
378377 // to be included in the assembly. We can't just add "python/" to the assembly's resource dir
379378 // list since that will copy unneeded / unwanted files.
@@ -388,7 +387,8 @@ object PySparkAssembly {
388387 if (! dst.isDirectory()) {
389388 require(dst.mkdirs())
390389 }
391- copy(src, dst)
390+
391+ Seq [File ]()
392392 }
393393 )
394394
@@ -416,42 +416,11 @@ object PySparkAssembly {
416416 output.write(buf, 0 , n)
417417 }
418418 }
419+ output.closeEntry()
419420 in.close()
420421 }
421422 }
422423
423- private def copy (src : File , dst : File ): Seq [File ] = {
424- src.listFiles().flatMap { f =>
425- val child = new File (dst, f.getName())
426- if (f.isDirectory()) {
427- child.mkdir()
428- copy(f, child)
429- } else if (f.getName().endsWith(" .py" )) {
430- var in : Option [FileInputStream ] = None
431- var out : Option [FileOutputStream ] = None
432- try {
433- in = Some (new FileInputStream (f))
434- out = Some (new FileOutputStream (child))
435-
436- val bytes = new Array [Byte ](1024 )
437- var read = 0
438- while (read >= 0 ) {
439- read = in.get.read(bytes)
440- if (read > 0 ) {
441- out.get.write(bytes, 0 , read)
442- }
443- }
444-
445- Some (child)
446- } finally {
447- in.foreach(_.close())
448- out.foreach(_.close())
449- }
450- } else {
451- None
452- }
453- }
454- }
455424}
456425
457426object Unidoc {
0 commit comments