You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by pw...@apache.org on 2014/04/30 18:51:11 UTC
git commit: Fix SPARK-1629: Spark should inline use of commons-lang
`SystemUtils.IS_...
Repository: spark
Updated Branches:
refs/heads/master ff5be9a41 -> 55100daa6
Fix SPARK-1629: Spark should inline use of commons-lang `SystemUtils.IS_...
...OS_WINDOWS`
Author: witgo <wi...@qq.com>
Closes #569 from witgo/SPARK-1629 and squashes the following commits:
31520eb [witgo] Merge branch 'master' of https://github.com/apache/spark into SPARK-1629
fcaafd7 [witgo] merge mastet
49e248e [witgo] Fix SPARK-1629: Spark should inline use of commons-lang `SystemUtils.IS_OS_WINDOWS`
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/55100daa
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/55100daa
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/55100daa
Branch: refs/heads/master
Commit: 55100daa6509bed851f6932845deffa861fef245
Parents: ff5be9a
Author: witgo <wi...@qq.com>
Authored: Wed Apr 30 09:49:45 2014 -0700
Committer: Patrick Wendell <pw...@gmail.com>
Committed: Wed Apr 30 09:49:45 2014 -0700
----------------------------------------------------------------------
core/src/main/scala/org/apache/spark/util/Utils.scala | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/55100daa/core/src/main/scala/org/apache/spark/util/Utils.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/util/Utils.scala b/core/src/main/scala/org/apache/spark/util/Utils.scala
index 79f314c..2c934a4 100644
--- a/core/src/main/scala/org/apache/spark/util/Utils.scala
+++ b/core/src/main/scala/org/apache/spark/util/Utils.scala
@@ -31,7 +31,6 @@ import scala.reflect.ClassTag
import scala.util.Try
import com.google.common.io.Files
-import org.apache.commons.lang.SystemUtils
import com.google.common.util.concurrent.ThreadFactoryBuilder
import org.apache.hadoop.fs.{FileSystem, FileUtil, Path}
import org.json4s._
@@ -50,7 +49,7 @@ private[spark] object Utils extends Logging {
val random = new Random()
def sparkBin(sparkHome: String, which: String): File = {
- val suffix = if (SystemUtils.IS_OS_WINDOWS) ".cmd" else ""
+ val suffix = if (isWindows) ".cmd" else ""
new File(sparkHome + File.separator + "bin", which + suffix)
}
@@ -614,7 +613,7 @@ private[spark] object Utils extends Logging {
*/
def isSymlink(file: File): Boolean = {
if (file == null) throw new NullPointerException("File must not be null")
- if (SystemUtils.IS_OS_WINDOWS) return false
+ if (isWindows) return false
val fileInCanonicalDir = if (file.getParent() == null) {
file
} else {
@@ -1018,7 +1017,7 @@ private[spark] object Utils extends Logging {
throw new IOException("Destination must be relative")
}
var cmdSuffix = ""
- val linkCmd = if (SystemUtils.IS_OS_WINDOWS) {
+ val linkCmd = if (isWindows) {
// refer to http://technet.microsoft.com/en-us/library/cc771254.aspx
cmdSuffix = " /s /e /k /h /y /i"
"cmd /c xcopy "
@@ -1063,6 +1062,12 @@ private[spark] object Utils extends Logging {
}
/**
+ * return true if this is Windows.
+ */
+ def isWindows = Option(System.getProperty("os.name")).
+ map(_.startsWith("Windows")).getOrElse(false)
+
+ /**
* Indicates whether Spark is currently running unit tests.
*/
private[spark] def isTesting = {