build: Reformat resource/csdk SConscripts to be more Pythonic 4/4 07/20907/5
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Mon, 19 Jun 2017 10:22:37 +0000 (12:22 +0200)
committerPhil Coval <philippe.coval@osg.samsung.com>
Tue, 20 Jun 2017 10:01:25 +0000 (10:01 +0000)
These are the resource/csdk/security subset

There are not intended to be any functional changes, with a minor exception:
in resource/csdk/security/provisioning/sample/SConscript, the samples are
now assigned to an appropriately constructed list, which is extended
in the case of MULTIPLE_OWNER, this list is then assigned an Alias.
This is done to avoid having two parallel lists and needing to keep
in sync.

Header lines with doubled comment styles were changed to just Python,
that is, change this style (quoted so git doesn't strip the lines):

"# // Copyright 2015 Samsung Electronics All Rights Reserved."

to this:

"# Copyright 2015 Samsung Electronics All Rights Reserved."

There is no consistently "pretty" way to fold long lines,
the choices were made by a tool (yapf) but occasionally overridden
to be a little more consistent

The test harness is now consistently imported as:
  from tools.scons.RunTest import run_test
rather than import * - should normally avoid importing whole
namespace unqualified unless it is really needed

Change-Id: If1876589b2cad83c1c4795dae5e3ddc59c78fca1
Signed-off-by: Mats Wichmann <mats@linux.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20805
Reviewed-by: George Nash <george.nash@intel.com>
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Origin: master
Signed-off-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20907
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
resource/csdk/security/SConscript
resource/csdk/security/provisioning/SConscript
resource/csdk/security/provisioning/sample/SConscript
resource/csdk/security/provisioning/src/SConscript
resource/csdk/security/provisioning/unittest/SConscript
resource/csdk/security/tool/SConscript
resource/csdk/security/unittest/SConscript
resource/csdk/security/unittests/SConscript

index 377be3c..131bf0f 100644 (file)
@@ -1,22 +1,22 @@
-# //******************************************************************
-# //
-# // Copyright 2015 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.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+# ******************************************************************
+#
+# Copyright 2015 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.
+#
+# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 #
 # libocsrm (static library) build script
 ##
@@ -33,106 +33,120 @@ target_os = libocsrm_env.get('TARGET_OS')
 ######################################################################
 with_upstream_libcoap = libocsrm_env.get('WITH_UPSTREAM_LIBCOAP')
 if with_upstream_libcoap == '1':
-       libocsrm_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
+    libocsrm_env.AppendUnique(CPPPATH=['#extlibs/libcoap/libcoap/include'])
 else:
-       libocsrm_env.AppendUnique(CPPPATH = ['#/resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
-
-libocsrm_env.PrependUnique(CPPPATH = [
-               '#/extlibs/mbedtls/mbedtls/include',
-               '#/resource/csdk/logger/include',
-               '#/resource/c_common/ocrandom/include',
-               '#/resource/csdk/include',
-               '#/resource/csdk/stack/include',
-               '#/resource/csdk/stack/include/internal',
-               '#/resource/oc_logger/include',
-               '#/resource/csdk/connectivity/external/inc',
-               '#/resource/csdk/connectivity/common/inc',
-               '#/resource/csdk/connectivity/inc',
-               '#/resource/csdk/connectivity/api',
-               '#/resource/csdk/security/include',
-               '#/resource/csdk/security/include/internal',
-               '#/resource/csdk/security/provisioning/include',
-               '#/extlibs/mbedtls/mbedtls/include'
-               ])
+    libocsrm_env.AppendUnique(CPPPATH=['#/resource/csdk/connectivity/lib/libcoap-4.1.1/include'])
+
+libocsrm_env.PrependUnique(CPPPATH=[
+    '#/extlibs/mbedtls/mbedtls/include',
+    '#/resource/csdk/logger/include',
+    '#/resource/c_common/ocrandom/include',
+    '#/resource/csdk/include',
+    '#/resource/csdk/stack/include',
+    '#/resource/csdk/stack/include/internal',
+    '#/resource/oc_logger/include',
+    '#/resource/csdk/connectivity/external/inc',
+    '#/resource/csdk/connectivity/common/inc',
+    '#/resource/csdk/connectivity/inc',
+    '#/resource/csdk/connectivity/api',
+    '#/resource/csdk/security/include',
+    '#/resource/csdk/security/include/internal',
+    '#/resource/csdk/security/provisioning/include',
+    '#/extlibs/mbedtls/mbedtls/include'
+])
 
 if target_os in ['windows', 'msys_nt']:
-       libocsrm_env.AppendUnique(LIBPATH = [os.path.join(libocsrm_env.get('BUILD_DIR'), 'resource', 'oc_logger')])
-if target_os in ['linux', 'android', 'tizen', 'msys_nt', 'windows'] and libocsrm_env.get('SECURED') == '1':
-       SConscript('provisioning/SConscript', 'libocsrm_env')
+    libocsrm_env.AppendUnique(LIBPATH=[
+        os.path.join(libocsrm_env.get('BUILD_DIR'), 'resource', 'oc_logger')
+    ])
+    libocsrm_env.AppendUnique(CCFLAGS=['/W4'])
+
+if libocsrm_env.get('SECURED') == '1':
+    if target_os in ['linux', 'android', 'tizen', 'msys_nt', 'windows']:
+        SConscript('provisioning/SConscript', 'libocsrm_env')
 
-if target_os in ['linux', 'windows', 'darwin'] and libocsrm_env.get('SECURED') == '1':
-       SConscript('tool/SConscript', 'libocsrm_env')
+    if target_os in ['linux', 'windows', 'darwin']:
+        SConscript('tool/SConscript', 'libocsrm_env')
 
 # As in the source code, it includes arduino Time library (C++)
 # It requires compile the .c with g++
 if target_os == 'arduino':
-       libocsrm_env.Replace(CC = libocsrm_env.get('CXX'))
-       libocsrm_env.Replace(CFLAGS = libocsrm_env.get('CXXFLAGS'))
+    libocsrm_env.Replace(CC=libocsrm_env.get('CXX'))
+    libocsrm_env.Replace(CFLAGS=libocsrm_env.get('CXXFLAGS'))
 
 if target_os not in ['arduino', 'windows']:
-       libocsrm_env.AppendUnique(CPPDEFINES  = ['WITH_POSIX', '_GNU_SOURCE'])
-       libocsrm_env.AppendUnique(CFLAGS = ['-std=c99', '-Wall'])
+    libocsrm_env.AppendUnique(CPPDEFINES=['WITH_POSIX', '_GNU_SOURCE'])
+    libocsrm_env.AppendUnique(CFLAGS=['-std=c99', '-Wall'])
 
-libocsrm_env.AppendUnique(LIBS = ['coap'])
+libocsrm_env.AppendUnique(LIBS=['coap'])
 
 if target_os == 'arduino':
-       libocsrm_env.AppendUnique(CPPDEFINES = ['NDEBUG', 'WITH_ARDUINO'])
+    libocsrm_env.AppendUnique(CPPDEFINES=['NDEBUG', 'WITH_ARDUINO'])
 elif target_os not in ['windows', 'msys_nt']:
-       libocsrm_env.AppendUnique(CFLAGS = ['-fPIC'])
-       libocsrm_env.AppendUnique(LIBS = ['m'])
+    libocsrm_env.AppendUnique(CFLAGS=['-fPIC'])
+    libocsrm_env.AppendUnique(LIBS=['m'])
 
 if target_os in ['darwin', 'ios']:
-       libocsrm_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
+    libocsrm_env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])
 
 if env.get('LOGGING'):
-       libocsrm_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    libocsrm_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 if env.get('MULTIPLE_OWNER') == '1':
-       libocsrm_env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
+    libocsrm_env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
 OCSRM_SRC = 'src/'
 libocsrm_src = [
-       OCSRM_SRC + 'secureresourcemanager.c',
-       OCSRM_SRC + 'resourcemanager.c',
-       OCSRM_SRC + 'aclresource.c',
-       OCSRM_SRC + 'verresource.c',
-       OCSRM_SRC + 'amaclresource.c',
-       OCSRM_SRC + 'pstatresource.c',
-       OCSRM_SRC + 'doxmresource.c',
-       OCSRM_SRC + 'credresource.c',
-       OCSRM_SRC + 'pconfresource.c',
-       OCSRM_SRC + 'dpairingresource.c',
-       OCSRM_SRC + 'policyengine.c',
-       OCSRM_SRC + 'psinterface.c',
-       OCSRM_SRC + 'srmresourcestrings.c',
-       OCSRM_SRC + 'srmutility.c',
-       OCSRM_SRC + 'iotvticalendar.c',
-       OCSRM_SRC + 'base64.c',
-       OCSRM_SRC + 'directpairing.c',
-       OCSRM_SRC + 'deviceonboardingstate.c'
-       ]
+    OCSRM_SRC + 'secureresourcemanager.c',
+    OCSRM_SRC + 'resourcemanager.c',
+    OCSRM_SRC + 'aclresource.c',
+    OCSRM_SRC + 'verresource.c',
+    OCSRM_SRC + 'amaclresource.c',
+    OCSRM_SRC + 'pstatresource.c',
+    OCSRM_SRC + 'doxmresource.c',
+    OCSRM_SRC + 'credresource.c',
+    OCSRM_SRC + 'pconfresource.c',
+    OCSRM_SRC + 'dpairingresource.c',
+    OCSRM_SRC + 'policyengine.c',
+    OCSRM_SRC + 'psinterface.c',
+    OCSRM_SRC + 'srmresourcestrings.c',
+    OCSRM_SRC + 'srmutility.c',
+    OCSRM_SRC + 'iotvticalendar.c',
+    OCSRM_SRC + 'base64.c',
+    OCSRM_SRC + 'directpairing.c',
+    OCSRM_SRC + 'deviceonboardingstate.c'
+]
 
 if libocsrm_env.get('SECURED') == '1':
-       libocsrm_src = libocsrm_src + [OCSRM_SRC + 'oxmpincommon.c', OCSRM_SRC + 'pbkdf2.c']
-       libocsrm_src = libocsrm_src + [OCSRM_SRC + 'crlresource.c', OCSRM_SRC + 'pkix_interface.c']
-       libocsrm_src = libocsrm_src + [OCSRM_SRC + 'oxmverifycommon.c']
-       libocsrm_src = libocsrm_src + [OCSRM_SRC + 'certhelpers.c', OCSRM_SRC + 'occertutility.c']
-       libocsrm_src = libocsrm_src + [OCSRM_SRC + 'csrresource.c']
-       libocsrm_src = libocsrm_src + [OCSRM_SRC + 'rolesresource.c']
-       libocsrm_src = libocsrm_src + [OCSRM_SRC + 'ocsecurity.c']
+    libocsrm_src = libocsrm_src + [
+        OCSRM_SRC + 'oxmpincommon.c',
+        OCSRM_SRC + 'pbkdf2.c'
+    ]
+    libocsrm_src = libocsrm_src + [
+        OCSRM_SRC + 'crlresource.c',
+        OCSRM_SRC + 'pkix_interface.c'
+    ]
+    libocsrm_src = libocsrm_src + [OCSRM_SRC + 'oxmverifycommon.c']
+    libocsrm_src = libocsrm_src + [
+        OCSRM_SRC + 'certhelpers.c',
+        OCSRM_SRC + 'occertutility.c'
+    ]
+    libocsrm_src = libocsrm_src + [OCSRM_SRC + 'csrresource.c']
+    libocsrm_src = libocsrm_src + [OCSRM_SRC + 'rolesresource.c']
+    libocsrm_src = libocsrm_src + [OCSRM_SRC + 'ocsecurity.c']
 
 if target_os in ['windows', 'msys_nt']:
-       libocsrm_src  = libocsrm_src + [OCSRM_SRC + 'strptime.c']
+    libocsrm_src = libocsrm_src + [OCSRM_SRC + 'strptime.c']
 
 libocsrm_src.extend(env['cbor_files'])
 
 # Insert a hack for Arduino, whose compiler may not support all defines expected
 # by tinycbor
 if target_os in ['arduino']:
-       libocsrm_env.AppendUnique(CPPDEFINES = ['INT64_MAX=0x7FFFFFFFFFFFFFFF'])
+    libocsrm_env.AppendUnique(CPPDEFINES=['INT64_MAX=0x7FFFFFFFFFFFFFFF'])
 
 libocsrm = libocsrm_env.StaticLibrary('ocsrm', libocsrm_src)
 
index 96d4cfb..62a2c86 100644 (file)
@@ -1,49 +1,50 @@
 # -*- mode: python; python-indent-offset: 4; indent-tabs-mode: nil -*-
-# //******************************************************************
-# //
-# // Copyright 2015 Samsung Electronics 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.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+# ******************************************************************
+#
+# Copyright 2015 Samsung Electronics 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.
+#
+# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 #
 Import('libocsrm_env')
 
 provisioning_env = libocsrm_env.Clone()
 
-SConscript('#build_common/thread.scons', exports = {'thread_env' : provisioning_env})
+SConscript('#/build_common/thread.scons',
+           exports={'thread_env': provisioning_env})
 target_os = provisioning_env.get('TARGET_OS')
 
 ######################################################################
 # Build flags
 ######################################################################
-provisioning_env.AppendUnique(CPPPATH = [
-               '#/resource/csdk/include',
-               '#/resource/c_common/oic_malloc/include',
-               '#/resource/csdk/security/provisioning/include/internal',
-               '#/resource/csdk/security/provisioning/include/cloud',
-               '#/resource/csdk/security/provisioning/include/oxm',
-               '#/resource/csdk/connectivity/inc/pkix',
-               '#/extlibs/asn1cert',
-               '#/extlibs/mbedtls/mbedtls/include'
-               ])
+provisioning_env.AppendUnique(CPPPATH=[
+    '#/resource/csdk/include',
+    '#/resource/c_common/oic_malloc/include',
+    '#/resource/csdk/security/provisioning/include/internal',
+    '#/resource/csdk/security/provisioning/include/cloud',
+    '#/resource/csdk/security/provisioning/include/oxm',
+    '#/resource/csdk/connectivity/inc/pkix',
+    '#/extlibs/asn1cert',
+    '#/extlibs/mbedtls/mbedtls/include'
+])
 
-provisioning_env.AppendUnique(CPPDEFINES= ['__WITH_DTLS__'])
+provisioning_env.AppendUnique(CPPDEFINES=['__WITH_DTLS__'])
 
 if 'g++' in provisioning_env.get('CXX'):
-    provisioning_env.AppendUnique(CXXFLAGS = ['-std=c++0x'])
+    provisioning_env.AppendUnique(CXXFLAGS=['-std=c++0x'])
 
 SConscript('src/SConscript', 'provisioning_env')
 
index 8362232..1351333 100644 (file)
@@ -1,22 +1,22 @@
-7# //******************************************************************
-# //
-# // Copyright 2015 Samsung Electronics 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.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+******************************************************************
+#
+# Copyright 2015 Samsung Electronics 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.
+#
+# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 #
 
 Import('env provisioning_env')
@@ -28,69 +28,81 @@ target_os = provisioning_sample_env.get('TARGET_OS')
 ######################################################################
 # Build flags
 ######################################################################
-provisioning_sample_env.AppendUnique(CPPPATH = [
-               '#/resource/csdk/include',
-               '#/extlibs/base64',
-               '#/resource/csdk/security/provisioning/sample/cloud'
-               ])
+provisioning_sample_env.AppendUnique(CPPPATH=[
+    '#/resource/csdk/include',
+    '#/extlibs/base64',
+    '#/resource/csdk/security/provisioning/sample/cloud'
+])
 
 target_os = env.get('TARGET_OS')
-provisioning_sample_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
-provisioning_sample_env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__'])
+provisioning_sample_env.AppendUnique(RPATH=[env.get('BUILD_DIR')])
+provisioning_sample_env.AppendUnique(CPPDEFINES=['__WITH_DTLS__'])
 
 if target_os not in ['windows']:
-       provisioning_sample_env.AppendUnique(CFLAGS = ['-std=c99'])
-       provisioning_sample_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread', '-fpermissive'])
-       provisioning_sample_env.AppendUnique(LIBS = ['pthread'])
+    provisioning_sample_env.AppendUnique(CFLAGS=['-std=c99'])
+    provisioning_sample_env.AppendUnique(
+        CXXFLAGS=['-std=c++0x', '-Wall', '-pthread', '-fpermissive'])
+    provisioning_sample_env.AppendUnique(LIBS=['pthread'])
 
 if target_os not in ['msys_nt', 'windows']:
-       provisioning_sample_env.AppendUnique(LIBS = ['dl', 'm'])
+    provisioning_sample_env.AppendUnique(LIBS=['dl', 'm'])
 else:
-       provisioning_sample_env.AppendUnique(LIBPATH = [os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk')])
+    provisioning_sample_env.AppendUnique(
+        LIBPATH=[os.path.join(env.get('BUILD_DIR'), 'resource', 'csdk')])
 
-provisioning_sample_env.PrependUnique(LIBS = ['coap'])
+provisioning_sample_env.PrependUnique(LIBS=['coap'])
 
 if target_os not in ['msys_nt', 'windows']:
-    provisioning_sample_env.PrependUnique(LIBS = ['connectivity_abstraction'])
+    provisioning_sample_env.PrependUnique(LIBS=['connectivity_abstraction'])
 
-provisioning_sample_env.PrependUnique(LIBS = ['oc', 'octbstack'])
+provisioning_sample_env.PrependUnique(LIBS=['oc', 'octbstack'])
 
 if target_os not in ['msys_nt', 'windows']:
-       provisioning_sample_env.PrependUnique(LIBS = ['oc_logger', 'ocpmapi', 'ocsrm'])
+    provisioning_sample_env.PrependUnique(
+        LIBS=['oc_logger', 'ocpmapi', 'ocsrm'])
 
 if env.get('SECURED') == '1':
-    provisioning_sample_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
+    provisioning_sample_env.AppendUnique(
+        LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if env.get('MULTIPLE_OWNER') == '1':
-       provisioning_sample_env.AppendUnique(CPPDEFINES = ['MULTIPLE_OWNER'])
+    provisioning_sample_env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
 
-provisioning_sample_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+provisioning_sample_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 if target_os == 'tizen':
-    provisioning_sample_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
+    provisioning_sample_env.AppendUnique(CPPDEFINES=['__TIZEN__'])
 
 if target_os in ['linux', 'tizen']:
     provisioning_sample_env.ParseConfig('pkg-config --cflags --libs sqlite3')
 else:
     if target_os in ['windows']:
-        provisioning_sample_env.AppendUnique(LIBS = ['sqlite3'])
-
+        provisioning_sample_env.AppendUnique(LIBS=['sqlite3'])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
 
-provisioningclient = provisioning_sample_env.Program('provisioningclient', 'provisioningclient.c')
-autoprovisioningclient = provisioning_sample_env.Program('autoprovisioningclient', 'autoprovisioningclient.c')
-sampleserver_justworks = provisioning_sample_env.Program('sampleserver_justworks', 'sampleserver_justworks.cpp')
-sampleserver_randompin = provisioning_sample_env.Program('sampleserver_randompin', 'sampleserver_randompin.cpp')
-sampleserver_mfg = provisioning_sample_env.Program('sampleserver_mfg', 'sampleserver_mfg.cpp')
-sampleserver_mvjustworks = provisioning_sample_env.Program('sampleserver_mvjustworks', 'sampleserver_mvjustworks.cpp')
-certgenerator = provisioning_sample_env.Program('certgenerator', 'certgenerator.cpp')
+provisioningclient = provisioning_sample_env.Program(
+    'provisioningclient', 'provisioningclient.c')
+autoprovisioningclient = provisioning_sample_env.Program(
+    'autoprovisioningclient', 'autoprovisioningclient.c')
+sampleserver_justworks = provisioning_sample_env.Program(
+    'sampleserver_justworks', 'sampleserver_justworks.cpp')
+sampleserver_randompin = provisioning_sample_env.Program(
+    'sampleserver_randompin', 'sampleserver_randompin.cpp')
+sampleserver_mfg = provisioning_sample_env.Program(
+    'sampleserver_mfg', 'sampleserver_mfg.cpp')
+sampleserver_mvjustworks = provisioning_sample_env.Program(
+    'sampleserver_mvjustworks', 'sampleserver_mvjustworks.cpp')
+certgenerator = provisioning_sample_env.Program(
+    'certgenerator', 'certgenerator.cpp')
 
 if provisioning_sample_env.get('MULTIPLE_OWNER') == '1':
-       subownerclient = provisioning_sample_env.Program('subownerclient', 'subownerclient.c')
-       sampleserver_preconfpin = provisioning_sample_env.Program('sampleserver_preconfpin', 'sampleserver_preconfpin.cpp')
+    subownerclient = provisioning_sample_env.Program(
+        'subownerclient', 'subownerclient.c')
+    sampleserver_preconfpin = provisioning_sample_env.Program(
+        'sampleserver_preconfpin', 'sampleserver_preconfpin.cpp')
 
 if target_os not in ['msys_nt', 'windows']:
     if provisioning_sample_env.get('WITH_TCP') == True:
@@ -98,59 +110,83 @@ if target_os not in ['msys_nt', 'windows']:
             'cloud/cloudAuth.c',
             'cloud/cloudCommon.c',
             'cloud/cloudWrapper.c',
-            'cloud/cloudDiscovery.c']
-        cloudClient = provisioning_sample_env.Program('cloudClient', cloud_src + ['cloudClient.c'])
-        cloudServer = provisioning_sample_env.Program('cloudServer', cloud_src + ['cloudServer.c', 'cloud/cloudResource.c'])
+            'cloud/cloudDiscovery.c'
+        ]
+        cloudClient = provisioning_sample_env.Program(
+            'cloudClient', cloud_src + ['cloudClient.c'])
+        cloudServer = provisioning_sample_env.Program(
+            'cloudServer',
+            cloud_src + [
+                'cloudServer.c',
+                'cloud/cloudResource.c'
+            ])
 
 src_dir = provisioning_sample_env.get('SRC_DIR')
 sec_provisioning_src_dir = src_dir + '/resource/csdk/security/provisioning/sample/'
-sec_provisioning_build_dir = env.get('BUILD_DIR') +'/resource/csdk/security/provisioning/sample/'
-
-
-clientdat = provisioning_sample_env.Install(sec_provisioning_build_dir,
-                                        sec_provisioning_src_dir + 'oic_svr_db_client.dat')
-justworksdat = provisioning_sample_env.Install(sec_provisioning_build_dir,
-                                    sec_provisioning_src_dir + 'oic_svr_db_server_justworks.dat')
-randompindat = provisioning_sample_env.Install(sec_provisioning_build_dir,
-                                    sec_provisioning_src_dir+ 'oic_svr_db_server_randompin.dat')
-mfgdat = provisioning_sample_env.Install(sec_provisioning_build_dir,
-                                    sec_provisioning_src_dir+ 'oic_svr_db_server_mfg.dat')
-randompin_with_emptyuuid_dat = provisioning_sample_env.Install(sec_provisioning_build_dir,
-                                    sec_provisioning_src_dir+ 'oic_svr_db_randompin_with_empty_deviceid.dat')
-mvjustworksdat = provisioning_sample_env.Install(sec_provisioning_build_dir,
-                                                                       sec_provisioning_src_dir + 'oic_svr_db_server_mvjustworks.dat')
+sec_provisioning_build_dir = env.get(
+    'BUILD_DIR') + '/resource/csdk/security/provisioning/sample/'
+
+clientdat = provisioning_sample_env.Install(
+    sec_provisioning_build_dir,
+    sec_provisioning_src_dir + 'oic_svr_db_client.dat')
+justworksdat = provisioning_sample_env.Install(
+    sec_provisioning_build_dir,
+    sec_provisioning_src_dir + 'oic_svr_db_server_justworks.dat')
+randompindat = provisioning_sample_env.Install(
+    sec_provisioning_build_dir,
+    sec_provisioning_src_dir + 'oic_svr_db_server_randompin.dat')
+mfgdat = provisioning_sample_env.Install(
+    sec_provisioning_build_dir,
+    sec_provisioning_src_dir + 'oic_svr_db_server_mfg.dat')
+randompin_with_emptyuuid_dat = provisioning_sample_env.Install(
+    sec_provisioning_build_dir,
+    sec_provisioning_src_dir + 'oic_svr_db_randompin_with_empty_deviceid.dat')
+mvjustworksdat = provisioning_sample_env.Install(
+    sec_provisioning_build_dir,
+    sec_provisioning_src_dir + 'oic_svr_db_server_mvjustworks.dat')
 
 if provisioning_sample_env.get('MULTIPLE_OWNER') == '1':
-       subownerclientdat = provisioning_sample_env.Install(sec_provisioning_build_dir,
-                                               sec_provisioning_src_dir + 'oic_svr_db_subowner_client.dat')
-       preconfserverdat = provisioning_sample_env.Install(sec_provisioning_build_dir,
-                                               sec_provisioning_src_dir + 'oic_svr_db_server_preconfpin.dat')
+    subownerclientdat = provisioning_sample_env.Install(
+        sec_provisioning_build_dir,
+        sec_provisioning_src_dir + 'oic_svr_db_subowner_client.dat')
+    preconfserverdat = provisioning_sample_env.Install(
+        sec_provisioning_build_dir,
+        sec_provisioning_src_dir + 'oic_svr_db_server_preconfpin.dat')
 
 if target_os not in ['msys_nt', 'windows']:
     if provisioning_sample_env.get('WITH_TCP') == True:
-        clouddat = provisioning_sample_env.Install(sec_provisioning_build_dir,
-                                            sec_provisioning_src_dir + 'cloud.dat')
-        rootcert = provisioning_sample_env.Install(sec_provisioning_build_dir,
-                                            sec_provisioning_src_dir + 'rootca.crt')
-        Alias("cloud", [clouddat, rootcert, cloudClient, cloudServer])
+        clouddat = provisioning_sample_env.Install(
+            sec_provisioning_build_dir, sec_provisioning_src_dir + 'cloud.dat')
+        rootcert = provisioning_sample_env.Install(
+            sec_provisioning_build_dir,
+            sec_provisioning_src_dir + 'rootca.crt')
+        Alias("cloud", [
+            clouddat,
+            rootcert,
+            cloudClient,
+            cloudServer
+        ])
         provisioning_sample_env.AppendTarget("cloud")
 
+sampleapps = [
+    provisioningclient,
+    autoprovisioningclient,
+    sampleserver_justworks,
+    sampleserver_randompin,
+    sampleserver_mfg,
+    clientdat,
+    justworksdat,
+    randompindat,
+    mfgdat,
+    randompin_with_emptyuuid_dat,
+    mvjustworksdat,
+]
 if provisioning_sample_env.get('MULTIPLE_OWNER') == '1':
-       Alias("samples", [
-                                       provisioningclient, subownerclient, autoprovisioningclient,
-                                       sampleserver_justworks, sampleserver_randompin, sampleserver_mfg,
-                                       sampleserver_preconfpin,
-                                       clientdat, subownerclientdat, preconfserverdat,
-                                       justworksdat, randompindat, mfgdat, randompin_with_emptyuuid_dat,
-                                       mvjustworksdat
-                               ])
-else:
-       Alias("samples", [
-                                       provisioningclient, autoprovisioningclient,
-                                       sampleserver_justworks, sampleserver_randompin, sampleserver_mfg,
-                                       clientdat,
-                                       justworksdat, randompindat, mfgdat, randompin_with_emptyuuid_dat,
-                                       mvjustworksdat
-                               ])
-
+    sampleapps.extend([
+        subownerclient,
+        sampleserver_preconfpin,
+        subownerclientdat,
+        preconfserverdat,
+    ])
+Alias('samples', sampleapps)
 provisioning_sample_env.AppendTarget('samples')
index 27e286f..2025a97 100644 (file)
@@ -1,48 +1,48 @@
 # -*- mode: python; python-indent-offset: 4; indent-tabs-mode: nil -*-
-# //******************************************************************
-# //
-# // Copyright 2015 Samsung Electronics 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.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+# ******************************************************************
+#
+# Copyright 2015 Samsung Electronics 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.
+#
+# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 #
 Import('provisioning_env')
 
 provisioning_lib_env = provisioning_env.Clone()
 target_os = provisioning_lib_env.get('TARGET_OS')
 
-provisioning_lib_env.PrependUnique(LIBS = ['coap'])
+provisioning_lib_env.PrependUnique(LIBS=['coap'])
 
 if target_os not in ['msys_nt', 'windows']:
     # octbstack.dll is exporting connectivity_abstraction APIs on Windows.
-    provisioning_lib_env.PrependUnique(LIBS = ['connectivity_abstraction'])
+    provisioning_lib_env.PrependUnique(LIBS=['connectivity_abstraction'])
 
-provisioning_lib_env.PrependUnique(LIBS = ['octbstack'])
+provisioning_lib_env.PrependUnique(LIBS=['octbstack'])
 
-provisioning_lib_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
+provisioning_lib_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if target_os in ['android']:
-    provisioning_lib_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
-    provisioning_lib_env.AppendUnique(LIBS = ['gnustl_static'])
+    provisioning_lib_env.AppendUnique(CXXFLAGS=['-frtti', '-fexceptions'])
+    provisioning_lib_env.AppendUnique(LIBS=['gnustl_static'])
 
 if target_os in ['darwin', 'ios']:
-    provisioning_lib_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
+    provisioning_lib_env.AppendUnique(CPPDEFINES=['_DARWIN_C_SOURCE'])
 
 if provisioning_lib_env.get('LOGGING'):
-    provisioning_lib_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    provisioning_lib_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 if provisioning_lib_env.get('MULTIPLE_OWNER') == '1':
     provisioning_lib_env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
@@ -60,42 +60,48 @@ provisioning_src = [
     'oxmjustworks.c',
     'oxmrandompin.c',
     'oxmmanufacturercert.c',
-    'provisioningdatabasemanager.c' ]
+    'provisioningdatabasemanager.c'
+]
 
 if provisioning_lib_env.get('MULTIPLE_OWNER') == '1':
     provisioning_src = provisioning_src + [
         'multipleownershiptransfermanager.c',
-        'oxmpreconfpin.c']
+        'oxmpreconfpin.c'
+    ]
 
 if provisioning_lib_env.get('WITH_TCP') == True:
-    provisioning_lib_env.AppendUnique(CPPDEFINES= ['__WITH_TLS__'])
+    provisioning_lib_env.AppendUnique(CPPDEFINES=['__WITH_TLS__'])
     provisioning_src = provisioning_src + [
-    'cloud/utils.c',
-    'cloud/crl.c',
-    'cloud/aclgroup.c',
-    'cloud/aclinvite.c',
-    'cloud/aclid.c',
-    'cloud/csr.c']
+        'cloud/utils.c',
+        'cloud/crl.c',
+        'cloud/aclgroup.c',
+        'cloud/aclinvite.c',
+        'cloud/aclid.c',
+        'cloud/csr.c'
+    ]
 
 if target_os in ['linux', 'tizen']:
     provisioning_lib_env.ParseConfig('pkg-config --cflags --libs sqlite3')
 else:
-    provisioning_lib_env.AppendUnique(CPPPATH = ['#/extlibs/sqlite3'])
+    provisioning_lib_env.AppendUnique(CPPPATH=['#/extlibs/sqlite3'])
     if target_os not in ['windows']:
-        provisioning_src = provisioning_src + ['#/extlibs/sqlite3/sqlite3.c' ]
+        provisioning_src = provisioning_src + ['#/extlibs/sqlite3/sqlite3.c']
 
 if target_os in ['android']:
-    provisioning_lib_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libocpmapi.so'])
+    provisioning_lib_env.AppendUnique(LINKFLAGS=['-Wl,-soname,libocpmapi.so'])
 
-internal_provisioning_lib = provisioning_lib_env.StaticLibrary('ocpmapi_internal', provisioning_src)
+internal_provisioning_lib = provisioning_lib_env.StaticLibrary(
+    'ocpmapi_internal', provisioning_src)
 provisioningserver = Flatten(internal_provisioning_lib)
 
 if target_os not in ['windows', 'msys_nt']:
-    static_provisioning_lib = provisioning_lib_env.StaticLibrary('ocpmapi', provisioning_src)
+    static_provisioning_lib = provisioning_lib_env.StaticLibrary(
+        'ocpmapi', provisioning_src)
     provisioningserver += Flatten(static_provisioning_lib)
 
     if target_os not in ['ios']:
-        shared_provisioning_lib = provisioning_lib_env.SharedLibrary('ocpmapi', provisioning_src)
+        shared_provisioning_lib = provisioning_lib_env.SharedLibrary(
+            'ocpmapi', provisioning_src)
         provisioningserver += Flatten(shared_provisioning_lib)
 
 provisioning_lib_env.InstallTarget(provisioningserver, 'ocpmapi')
index 78148a0..282eeb9 100644 (file)
@@ -1,22 +1,22 @@
-# //******************************************************************
-# //
-# // Copyright 2015 Samsung Electronics 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.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+# ******************************************************************
+#
+# Copyright 2015 Samsung Electronics 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.
+#
+# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 import os
 import os.path
@@ -35,70 +35,73 @@ rd_mode = sptest_env.get('RD_MODE')
 ######################################################################
 with_upstream_libcoap = sptest_env.get('WITH_UPSTREAM_LIBCOAP')
 if with_upstream_libcoap == '1':
-       sptest_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
+    sptest_env.AppendUnique(CPPPATH=['#extlibs/libcoap/libcoap/include'])
 else:
-       sptest_env.AppendUnique(CPPPATH = ['../../../connectivity/lib/libcoap-4.1.1/include'])
-
-sptest_env.PrependUnique(CPPPATH = [
-               '../include',
-               '../../include',
-               '../include/internal',
-               '../../../include',
-               '../../../ocrandom/include',
-               '../../../logger/include',
-               '../../../stack/include',
-               '../../../security/include',
-               '../../../security/include/internal',
-               '../../../security/provisioning/include/internal',
-               '../../../../oc_logger/include',
-               '../include/oxm',
-               '../../../../../extlibs/base64',
-               '../../../connectivity/inc',
-               '../../../connectivity/inc/pkix',
-               '../../../connectivity/common/inc',
-               '../../../connectivity/api'
-               ])
-
-sptest_env.PrependUnique(LIBS = [   'ocpmapi_internal',
-                                    'oc',
-                                    'octbstack_internal',
-                                    'ocsrm',
-                                    'routingmanager',
-                                    'oc_logger_internal',
-                                    'connectivity_abstraction_internal',
-                                    'coap'])
+    sptest_env.AppendUnique(CPPPATH=['../../../connectivity/lib/libcoap-4.1.1/include'])
+
+sptest_env.PrependUnique(CPPPATH=[
+    '../include',
+    '../../include',
+    '../include/internal', '../../../include',
+    '../../../ocrandom/include',
+    '../../../logger/include',
+    '../../../stack/include',
+    '../../../security/include',
+    '../../../security/include/internal',
+    '../../../security/provisioning/include/internal',
+    '../../../../oc_logger/include',
+    '../include/oxm',
+    '../../../../../extlibs/base64',
+    '../../../connectivity/inc',
+    '../../../connectivity/inc/pkix',
+    '../../../connectivity/common/inc',
+    '../../../connectivity/api'
+])
+
+sptest_env.PrependUnique(LIBS=[
+    'ocpmapi_internal',
+    'oc',
+    'octbstack_internal',
+    'ocsrm',
+    'routingmanager',
+    'oc_logger_internal',
+    'connectivity_abstraction_internal',
+    'coap'
+])
 
 if sptest_env.get('SECURED') == '1':
-    sptest_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
+    sptest_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if not sptest_env.get('RELEASE'):
-       sptest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    sptest_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 if sptest_env.get('MULTIPLE_OWNER') == '1':
-       sptest_env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
+    sptest_env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
 
-sptest_env.AppendUnique(LIBS = ['octbstack_internal'])
+sptest_env.AppendUnique(LIBS=['octbstack_internal'])
 
 if target_os in ['msys_nt', 'windows']:
-    sptest_env.AppendUnique(LIBS = ['sqlite3'])
+    sptest_env.AppendUnique(LIBS=['sqlite3'])
 else:
     if target_os in ['linux', 'tizen']:
-        sptest_env.ParseConfig('pkg-config --cflags --libs sqlite3 gobject-2.0 gio-2.0 glib-2.0')
-# TODO: remove this workaround needed for g++-4.7
-        sptest_env.Append(LIBS = ['m'])
+        sptest_env.ParseConfig(
+            'pkg-config --cflags --libs sqlite3 gobject-2.0 gio-2.0 glib-2.0')
+        # TODO: remove this workaround needed for g++-4.7
+        sptest_env.Append(LIBS=['m'])
 
 ######################################################################
 # Source files and Targets
 ######################################################################
-unittest_src = ['pmutilitytest.cpp',
-                'secureresourceprovider.cpp',
-                'provisioningdatabasemanager.cpp',
-                'ocprovisioningmanager.cpp',
-                'credentialgeneratortest.cpp',
-                ]
+unittest_src = [
+    'pmutilitytest.cpp',
+    'secureresourceprovider.cpp',
+    'provisioningdatabasemanager.cpp',
+    'ocprovisioningmanager.cpp',
+    'credentialgeneratortest.cpp',
+]
 
 if target_os not in ['windows']:
-    unittest_src += [ 'otmunittest.cpp' ]
+    unittest_src += ['otmunittest.cpp']
 
 unittest = sptest_env.Program('unittest', unittest_src)
 
@@ -112,14 +115,14 @@ Alias("test", [unittest])
 sptest_env.AppendTarget('test')
 # TODO: fix test for all supported configurations
 if sptest_env.get('TEST') == '1' and sptest_env.get('SECURED') != '1':
-       if target_os in ['linux', 'windows']:
-               out_dir = sptest_env.get('BUILD_DIR')
-               result_dir = os.path.join(sptest_env.get('BUILD_DIR'), 'test_out') + os.sep
-               if not os.path.isdir(result_dir):
-                       os.makedirs(result_dir)
-               sptest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
-               sptest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
-               sptest_env.AppendENVPath('PATH', sptest_env.get('BUILD_DIR'))
-               run_test(sptest_env,
-                                'resource_csdk_security_provisioning_unittest.memcheck',
-                                'resource/csdk/security/provisioning/unittest/unittest')
+    if target_os in ['linux', 'windows']:
+        out_dir = sptest_env.get('BUILD_DIR')
+        result_dir = os.path.join(sptest_env.get('BUILD_DIR'), 'test_out') + os.sep
+        if not os.path.isdir(result_dir):
+            os.makedirs(result_dir)
+        sptest_env.AppendENVPath('GTEST_OUTPUT', ['xml:' + result_dir])
+        sptest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
+        sptest_env.AppendENVPath('PATH', sptest_env.get('BUILD_DIR'))
+        run_test(sptest_env,
+                 'resource_csdk_security_provisioning_unittest.memcheck',
+                 'resource/csdk/security/provisioning/unittest/unittest')
index 2fc9e9d..5820028 100644 (file)
@@ -1,22 +1,22 @@
-# //******************************************************************
-# //
-# // Copyright 2015 Samsung Electronics 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.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+# ******************************************************************
+#
+# Copyright 2015 Samsung Electronics 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.
+#
+# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 #
 Import('libocsrm_env')
 import os
@@ -30,43 +30,54 @@ target_os = tools_env.get('TARGET_OS')
 ######################################################################
 with_upstream_libcoap = tools_env.get('WITH_UPSTREAM_LIBCOAP')
 if with_upstream_libcoap == '1':
-    tools_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
+    tools_env.AppendUnique(CPPPATH=['#extlibs/libcoap/libcoap/include'])
 else:
-    tools_env.AppendUnique(CPPPATH = ['../../connectivity/lib/libcoap-4.1.1/include'])
+    tools_env.AppendUnique(CPPPATH=['../../connectivity/lib/libcoap-4.1.1/include'])
 
-tools_env.PrependUnique(CPPPATH = ['#/extlibs/cjson',
-                                  '../../include',
-                                  '../../stack/include',
-                                  '../../stack/include/internal',
-                                  '../../logger/include',
-                                  '../../../oc_logger/include',
-                                  '../../connectivity/api',
-                                  '../../connectivity/inc/pkix',
-                                  '../include',
-                                  '../include/internal'
-                                  ])
-tools_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-Wextra', '-std=c++0x'])
-tools_env.AppendUnique(RPATH = [tools_env.get('BUILD_DIR')])
+tools_env.PrependUnique(CPPPATH=[
+    '#/extlibs/cjson',
+    '../../include',
+    '../../stack/include',
+    '../../stack/include/internal',
+    '../../logger/include',
+    '../../../oc_logger/include',
+    '../../connectivity/api',
+    '../../connectivity/inc/pkix',
+    '../include',
+    '../include/internal'
+])
+tools_env.AppendUnique(CXXFLAGS=['-O2', '-g', '-Wall', '-Wextra', '-std=c++0x'])
+tools_env.AppendUnique(RPATH=[tools_env.get('BUILD_DIR')])
 
 if target_os in ['windows', 'msys_nt']:
-    # Macro needed for Windows builds to avoid __declspec(dllexport) and __declspec(dllimport) for cJSON APIs.
-    tools_env.AppendUnique(CPPDEFINES = ['CJSON_HIDE_SYMBOLS'])
+    # Macro needed for Windows builds to avoid __declspec(dllexport) and
+    # __declspec(dllimport) for cJSON APIs.
+    tools_env.AppendUnique(CPPDEFINES=['CJSON_HIDE_SYMBOLS'])
 
 if target_os not in ['darwin', 'msys_nt', 'windows']:
-    tools_env.PrependUnique(LIBS = ['octbstack', 'ocsrm', 'm'])
+    tools_env.PrependUnique(LIBS=['octbstack', 'ocsrm', 'm'])
 else:
     if target_os in ['darwin']:
-        tools_env.AppendUnique(LIBS = ['octbstack', 'connectivity_abstraction'])
+        tools_env.AppendUnique(LIBS=['octbstack', 'connectivity_abstraction'])
     else:
-        # This IoTivity-internal app calls non-Public APIs, so link with LIBS intended
-        # for IoTivity-internal tests (such as octbstack_internal).
-        tools_env.AppendUnique(LIBS = ['octbstack_internal', 'connectivity_abstraction_internal'])
+        # This IoTivity-internal app calls non-Public APIs, so link with
+        # internal LIBS
+        tools_env.AppendUnique(LIBS=[
+            'octbstack_internal',
+            'connectivity_abstraction_internal'
+        ])
         if target_os in ['windows']:
-            tools_env.AppendUnique(LIBS = ['sqlite3'])
-    tools_env.AppendUnique(LIBS = ['coap', 'mbedtls', 'mbedx509', 'mbedcrypto',
-                                   'ocsrm', 'routingmanager'])
+            tools_env.AppendUnique(LIBS=['sqlite3'])
+    tools_env.AppendUnique(LIBS=[
+        'coap',
+        'mbedtls',
+        'mbedx509',
+        'mbedcrypto',
+        'ocsrm',
+        'routingmanager'
+    ])
 
-tools_env.PrependUnique(LIBS = ['cjson'])
+tools_env.PrependUnique(LIBS=['cjson'])
 
 ######################################################################
 # Source files and Targets
index 5119cad..52ba3d2 100644 (file)
@@ -1,26 +1,26 @@
-# //******************************************************************
-# //
-# // Copyright 2015 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.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+# ******************************************************************
+#
+# Copyright 2015 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.
+#
+# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 import os
 import os.path
-from tools.scons.RunTest import *
+from tools.scons.RunTest import run_test
 
 Import('test_env')
 
@@ -35,72 +35,73 @@ rd_mode = srmtest_env.get('RD_MODE')
 ######################################################################
 with_upstream_libcoap = srmtest_env.get('WITH_UPSTREAM_LIBCOAP')
 if with_upstream_libcoap == '1':
-       srmtest_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
+    srmtest_env.AppendUnique(CPPPATH=['#extlibs/libcoap/libcoap/include'])
 else:
-       srmtest_env.AppendUnique(CPPPATH = ['../../connectivity/lib/libcoap-4.1.1/include'])
-
-srmtest_env.PrependUnique(CPPPATH = [
-        '../../../c_common/oic_malloc/include',
-        '../../connectivity/inc',
-        '../../connectivity/inc/pkix',
-        '../../connectivity/api',
-        '../../connectivity/external/inc',
-        '../include/internal',
-        '../../logger/include',
-        '../../include',
-        '../../stack/include',
-        '../../stack/include/internal',
-        '../../../oc_logger/include',
-        '../provisioning/include',
-        '../include'
-        ])
-
-srmtest_env.PrependUnique(LIBS = [
-        'octbstack_internal',
-        'ocsrm',
-        'routingmanager',
-        'oc_logger_internal',
-        'connectivity_abstraction_internal',
-        'coap'
-        ])
+    srmtest_env.AppendUnique(CPPPATH=['../../connectivity/lib/libcoap-4.1.1/include'])
+
+srmtest_env.PrependUnique(CPPPATH=[
+    '../../../c_common/oic_malloc/include',
+    '../../connectivity/inc',
+    '../../connectivity/inc/pkix',
+    '../../connectivity/api',
+    '../../connectivity/external/inc',
+    '../include/internal',
+    '../../logger/include',
+    '../../include',
+    '../../stack/include',
+    '../../stack/include/internal',
+    '../../../oc_logger/include',
+    '../provisioning/include',
+    '../include'
+])
+
+srmtest_env.PrependUnique(LIBS=[
+    'octbstack_internal',
+    'ocsrm',
+    'routingmanager',
+    'oc_logger_internal',
+    'connectivity_abstraction_internal',
+    'coap'
+])
 
 if srmtest_env.get('SECURED') == '1':
-    srmtest_env.AppendUnique(LIBS = ['mbedtls','mbedx509','mbedcrypto'])
+    srmtest_env.AppendUnique(LIBS=['mbedtls', 'mbedx509', 'mbedcrypto'])
 
 if srmtest_env.get('LOGGING') == '1':
-    srmtest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+    srmtest_env.AppendUnique(CPPDEFINES=['TB_LOG'])
 
 if srmtest_env.get('MULTIPLE_OWNER') == '1':
     srmtest_env.AppendUnique(CPPDEFINES=['MULTIPLE_OWNER'])
 
 if target_os == 'windows':
-    srmtest_env.AppendUnique(LIBS = ['sqlite3'])
+    srmtest_env.AppendUnique(LIBS=['sqlite3'])
 else:
     # TODO: Implement feature check.
-    srmtest_env.AppendUnique(CPPDEFINES = ['HAVE_LOCALTIME_R'])
+    srmtest_env.AppendUnique(CPPDEFINES=['HAVE_LOCALTIME_R'])
 
     if target_os in ['linux', 'tizen']:
-        srmtest_env.ParseConfig('pkg-config --cflags --libs sqlite3 gobject-2.0 gio-2.0 glib-2.0')
+        srmtest_env.ParseConfig(
+            'pkg-config --cflags --libs sqlite3 gobject-2.0 gio-2.0 glib-2.0')
 
 ######################################################################
 # Source files and Targets
 ######################################################################
 unittest = srmtest_env.Program('unittest', [
-        'aclresourcetest.cpp',
-        'amaclresourcetest.cpp',
-        'pstatresource.cpp',
-        'doxmresource.cpp',
-        'policyengine.cpp',
-        'securityresourcemanager.cpp',
-        'credentialresource.cpp',
-        'srmutility.cpp',
-        'iotvticalendartest.cpp',
-        'base64tests.cpp',
-        'pbkdf2tests.cpp',
-        'srmtestcommon.cpp',
-        'directpairingtest.cpp',
-        'crlresourcetest.cpp'
-        ])
+    'aclresourcetest.cpp',
+    'amaclresourcetest.cpp',
+    'pstatresource.cpp',
+    'doxmresource.cpp',
+    'policyengine.cpp',
+    'securityresourcemanager.cpp',
+    'credentialresource.cpp',
+    'srmutility.cpp',
+    'iotvticalendartest.cpp',
+    'base64tests.cpp',
+    'pbkdf2tests.cpp',
+    'srmtestcommon.cpp',
+    'directpairingtest.cpp',
+    'crlresourcetest.cpp'
+])
 
 Alias("test", [unittest])
 
@@ -108,27 +109,39 @@ unittest_src_dir = os.path.join(src_dir, 'resource', 'csdk', 'security', 'unitte
 unittest_build_dir = os.path.join(srmtest_env.get('BUILD_DIR'), 'resource', 'csdk', 'security', 'unittest')
 unittest_build_dir = os.path.normpath(unittest_build_dir) + os.sep
 
-srmtest_env.AppendUnique(CPPDEFINES = ['SECURITY_BUILD_UNITTEST_DIR='+unittest_build_dir.encode('string_escape').replace("\\", "\\\\")])
-
-srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
-    unittest_src_dir + 'oic_unittest.json'))
-srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
-    unittest_src_dir + 'oic_unittest_acl1.json'))
-srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
-    unittest_src_dir + 'oic_unittest_default_acl.json'))
-srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
-    unittest_src_dir + 'oic_svr_db.json'))
-
-srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
-    unittest_src_dir + 'oic_unittest.dat'))
-srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
-    unittest_src_dir + 'oic_unittest_acl1.dat'))
-srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
-    unittest_src_dir + 'oic_unittest_default_acl.dat'))
-srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
-    unittest_src_dir + 'oic_svr_db_prov.dat'))
-srmtest_env.Alias("install", srmtest_env.Install( unittest_build_dir,
-    unittest_src_dir + 'oic_svr_db.dat'))
+srmtest_env.AppendUnique(CPPDEFINES=[
+    'SECURITY_BUILD_UNITTEST_DIR=' +
+    unittest_build_dir.encode('string_escape').replace("\\", "\\\\")
+])
+
+srmtest_env.Alias(
+    "install",
+    srmtest_env.Install(unittest_build_dir, unittest_src_dir + 'oic_unittest.json'))
+srmtest_env.Alias(
+    "install",
+    srmtest_env.Install(unittest_build_dir, unittest_src_dir + 'oic_unittest_acl1.json'))
+srmtest_env.Alias(
+    "install",
+    srmtest_env.Install(unittest_build_dir, unittest_src_dir + 'oic_unittest_default_acl.json'))
+srmtest_env.Alias(
+    "install",
+    srmtest_env.Install(unittest_build_dir, unittest_src_dir + 'oic_svr_db.json'))
+
+srmtest_env.Alias(
+    "install",
+    srmtest_env.Install(unittest_build_dir, unittest_src_dir + 'oic_unittest.dat'))
+srmtest_env.Alias(
+    "install",
+    srmtest_env.Install(unittest_build_dir, unittest_src_dir + 'oic_unittest_acl1.dat'))
+srmtest_env.Alias(
+    "install",
+    srmtest_env.Install(unittest_build_dir, unittest_src_dir + 'oic_unittest_default_acl.dat'))
+srmtest_env.Alias(
+    "install",
+    srmtest_env.Install(unittest_build_dir, unittest_src_dir + 'oic_svr_db_prov.dat'))
+srmtest_env.Alias(
+    "install",
+    srmtest_env.Install(unittest_build_dir, unittest_src_dir + 'oic_svr_db.dat'))
 
 srmtest_env.AppendTarget('test')
 if srmtest_env.get('TEST') == '1':
@@ -137,6 +150,6 @@ if srmtest_env.get('TEST') == '1':
         result_dir = os.path.join(srmtest_env.get('BUILD_DIR'), 'test_out') + os.sep
         if not os.path.isdir(result_dir):
             os.makedirs(result_dir)
-        srmtest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
+        srmtest_env.AppendENVPath('GTEST_OUTPUT', ['xml:' + result_dir])
         srmtest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
-        run_test(srmtest_env,'ut','resource/csdk/security/unittest/unittest')
+        run_test(srmtest_env, 'ut', 'resource/csdk/security/unittest/unittest')
index f14c963..b72cb3f 100644 (file)
@@ -1,4 +1,4 @@
-#******************************************************************
+# *****************************************************************
 #
 # Copyright 2016 Microsoft
 #
@@ -26,5 +26,10 @@ Import('test_env')
 
 security_test_env = test_env.Clone()
 
-SConscript('../unittest/SConscript', exports = { 'test_env' : security_test_env })
-SConscript('../provisioning/unittest/SConscript', exports = { 'test_env' : security_test_env })
+if security_test_env.get('TARGET_OS') in ['windows', 'msys_nt']:
+    security_test_env.AppendUnique(CCFLAGS=['/W4'])
+
+SConscript('../unittest/SConscript',
+           exports={'test_env': security_test_env})
+SConscript('../provisioning/unittest/SConscript',
+           exports={'test_env': security_test_env})