Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / tools / scons / Configure.py
index 88c184a..94db96b 100644 (file)
@@ -1,88 +1,88 @@
-# -*- coding: utf-8 -*-\r
-\r
-# *********************************************************************\r
-#\r
-# Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.\r
-#\r
-# *********************************************************************\r
-#\r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-#\r
-#      http:#www.apache.org/licenses/LICENSE-2.0\r
-#\r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-#\r
-# *********************************************************************\r
-\r
-# This builder executes configure\r
-\r
-import os, subprocess\r
-import SCons.Builder, SCons.Node, SCons.Errors\r
-\r
-# Create the output message\r
-#\r
-# @param s original message\r
-# @param target target name\r
-# @param source source name\r
-# @param env environment object\r
-def __message( s, target, source, env ) :\r
-    print "Configuring using [%s] ..." % (source[0])\r
-\r
-# Create the action\r
-#\r
-# @param target target file on the local drive\r
-# @param source URL for download\r
-# @@param env environment object\r
-def __action( target, source, env ) :\r
-    cmd = None\r
-\r
-    # Windows...\r
-    if env["PLATFORM"] in ["win32"] :\r
-        if env.WhereIs("cmd") :\r
-            # TODO: Add Windows Support\r
-            cmd = None\r
-\r
-    # read the tools on *nix systems and sets the default parameters\r
-    elif env["PLATFORM"] in ["darwin", "linux", "posix"] :\r
-        if env.WhereIs("sh") :\r
-            cmd = "./configure"\r
-\r
-    if not cmd :\r
-        raise SCons.Errors.StopError("Configure shell on this platform [%s] unkown" % (env["PLATFORM"]))\r
-\r
-    # We need to be in the target's directory\r
-    cwd = os.path.dirname(os.path.realpath(target[0].path))\r
-\r
-    # build it now (we need the shell, because some programs need it)\r
-    devnull = open(os.devnull, "wb")\r
-    handle  = subprocess.Popen( cmd, shell=True, cwd=cwd, stdout=devnull )\r
-\r
-    if handle.wait() <> 0 :\r
-        raise SCons.Errors.BuildError( "Configuring script [%s] on the source [%s]" % (cmd, source[0])  )\r
-\r
-# Define the builder's emitter\r
-#\r
-# @param target target file on the local drive\r
-# @param source \r
-# @param env environment object\r
-def __emitter( target, source, env ) :\r
-    return target, source\r
-\r
-# Generate function which adds the builder to the environment,\r
-#\r
-# @param env environment object\r
-def generate( env ) :\r
-    env["BUILDERS"]["Configure"] = SCons.Builder.Builder( action = __action,  emitter = __emitter,  target_factory = SCons.Node.FS.File,  source_factory = SCons.Node.FS.File,  single_source = True,  PRINT_CMD_LINE_FUNC = __message )\r
-\r
-# Exist function for the builder\r
-#\r
-# @param env environment object\r
-# @return true\r
-def exists( env ) :\r
-    return 1\r
+# -*- coding: utf-8 -*-
+
+# *********************************************************************
+#
+# Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
+#
+# *********************************************************************
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http:#www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# *********************************************************************
+
+# This builder executes configure
+
+import os, subprocess
+import SCons.Builder, SCons.Node, SCons.Errors
+
+# Create the output message
+#
+# @param s original message
+# @param target target name
+# @param source source name
+# @param env environment object
+def __message( s, target, source, env ) :
+    print "Configuring using [%s] ..." % (source[0])
+
+# Create the action
+#
+# @param target target file on the local drive
+# @param source URL for download
+# @@param env environment object
+def __action( target, source, env ) :
+    cmd = None
+
+    # Windows...
+    if env["PLATFORM"] in ["win32"] :
+        if env.WhereIs("cmd") :
+            # TODO: Add Windows Support
+            cmd = None
+
+    # read the tools on *nix systems and sets the default parameters
+    elif env["PLATFORM"] in ["darwin", "linux", "posix"] :
+        if env.WhereIs("sh") :
+            cmd = "./configure"
+
+    if not cmd :
+        raise SCons.Errors.StopError("Configure shell on this platform [%s] unkown" % (env["PLATFORM"]))
+
+    # We need to be in the target's directory
+    cwd = os.path.dirname(os.path.realpath(target[0].path))
+
+    # build it now (we need the shell, because some programs need it)
+    devnull = open(os.devnull, "wb")
+    handle  = subprocess.Popen( cmd, shell=True, cwd=cwd, stdout=devnull )
+
+    if handle.wait() <> 0 :
+        raise SCons.Errors.BuildError( "Configuring script [%s] on the source [%s]" % (cmd, source[0])  )
+
+# Define the builder's emitter
+#
+# @param target target file on the local drive
+# @param source 
+# @param env environment object
+def __emitter( target, source, env ) :
+    return target, source
+
+# Generate function which adds the builder to the environment,
+#
+# @param env environment object
+def generate( env ) :
+    env["BUILDERS"]["Configure"] = SCons.Builder.Builder( action = __action,  emitter = __emitter,  target_factory = SCons.Node.FS.File,  source_factory = SCons.Node.FS.File,  single_source = True,  PRINT_CMD_LINE_FUNC = __message )
+
+# Exist function for the builder
+#
+# @param env environment object
+# @return true
+def exists( env ) :
+    return 1