Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/5461#discussion_r28316737
--- Diff: project/SparkBuild.scala ---
@@ -345,6 +349,60 @@ object Assembly {
)
}
+object PySparkAssembly {
+ import sbtassembly.Plugin._
+ import AssemblyKeys._
+
+ lazy val settings = Seq(
+ unmanagedJars in Compile += { BuildCommons.sparkHome /
"python/lib/py4j-0.8.2.1-src.zip" },
+ // Use a resource generator to copy all .py files from python/pyspark
into a managed directory
+ // to be included in the assembly. We can't just add "python/" to the
assembly's resource dir
+ // list since that will copy unneeded / unwanted files.
+ resourceGenerators in Compile <+= resourceManaged in Compile map {
outDir: File =>
+ val dst = new File(outDir, "pyspark")
+ if (!dst.isDirectory()) {
+ require(dst.mkdirs())
+ }
+
+ val src = new File(BuildCommons.sparkHome, "python/pyspark")
+ copy(src, dst)
+ }
+ )
+
+ private def copy(src: File, dst: File): Seq[File] = {
--- End diff --
Dang, I guess we can't use Guava or Java 7 nio here to just call an
existing "copy" method, and shelling out is maybe error prone. I suppose we
can't find any support in the assembly plugin. Well the result empirically
looks like a correct fix, even if I'm not an SBT expert. LGTM.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]