Cherry Pick change to enable building with SCons3 03/23103/2
authorIbrahim Esmat <iesmat@microsoft.com>
Tue, 19 Sep 2017 23:41:18 +0000 (17:41 -0600)
committerIbrahim Esmat <iesmat@microsoft.com>
Wed, 8 Nov 2017 19:38:33 +0000 (11:38 -0800)
commite5418f0600daf2556e00232c49b8470ace95df4b
treeb975b5ab2e53d984b6186f0458a03c5b7b83eedb
parentb1a345b200124aa09187ad6c1a762d5821c9ddf2
Cherry Pick change to enable building with SCons3

Cherry Pick Mats change from master to enable building with SCons 3.0
in 1.3-rel branch. This change and the change in review
https://gerrit.iotivity.org/gerrit/#/c/22809 will be needed to merge
together.

With these 2 changes merged to 1.3-rel, you can successfully build
IoTivity with SCons 3.0. Which will also allow you to build the
UWP versions of the libraries needed for UWP Apps.

Change in master:
Prepare for scons3: change prints and others

In preparation for scons3, recently released, modify remaining print
statements by surrounding them with parens so they look like function
calls. That takes care of the scons3 syntax requirement.

The remaining instances of the sequence "print FOO; Exit(1)" were
changed to "msg = FOO; Exit(msg)" - this helps with the change by
not even using the print statement, and by giving the message to
the output function, it is sent to the error stream rather than
the output stream.

Calls to dictionary keys() and values() are now wrapped in list(),
on Python 3 these return special objects, not the expected list.
That's harmless to Python 2 usage.

The old exception format "except FooErr, err" is no longer supported;
since the Python 3 format "except FooErr as err" has been available
since Python 2.6, there is no problem switching these.

Some instances of using the commands module in extlibs changes to use
subprocess module. Change is transparent.

A couple of instances of filter(lambda ...)) were changes to
a python list comprehension, this is considered preferred for
Python 3 (change was suggested by a conversion tool)

Note on print() change:

  When running with Python2, the print statement is still used. That
  has a bit of an impact: print(a) is just prints the argument, but
  print(a, b, c) is interpreted as printing a tuple (a, b, c), so we
  could see:

  >>> print "This", "is", "a", "test"
  This is a test
  >>> print("This", "is", "a", "test")
  ('This', 'is', 'a', 'test')

  The second is not pretty.  You can make Python2 code use the function
  instead of the statement:

  >>> from __future__ import print_function
  >>> print("This", "is", "a", "test")
  This is a test

  but that's a pain, so the small number of existing prints which
  used a comma as argument separators were updated to use addition,
  so now we're concatenating a string to produce one arg instead
  of supplying multiple "arguments" that would be misinterpreted
  as a tuple in print().  It's fine to add the import statement
  if it's needed.

Change-Id: Idac00e1389b79ee65da4a2eb6ef3246551b66843
Signed-off-by: Mats Wichmann <mats@linux.com>
Signed-off-by: Ibrahim Esmat <iesmat@microsoft.com>
75 files changed:
bridging/common/SConscript
bridging/mini_plugin_manager/SConscript
bridging/plugins/hue_plugin/SConscript
bridging/plugins/lifx_plugin/SConscript
bridging/plugins/lyric_plugin/SConscript
bridging/plugins/nest_plugin/SConscript
build_common/SConscript
build_common/android/SConscript
build_common/arduino/SConscript
build_common/external_builders.scons
build_common/tizen/SConscript
build_common/windows/SConscript
extlibs/android/gradle/SConscript
extlibs/android/ndk/SConscript
extlibs/android/sdk/SConscript
extlibs/arduino/SConscript
extlibs/boost/SConscript
extlibs/gtest/SConscript
extlibs/hippomocks/SConscript
extlibs/libcoap/SConscript
extlibs/libstrophe/SConscript
extlibs/mbedtls/SConscript
extlibs/raxmpp/SConscript
extlibs/sqlite3/SConscript
extlibs/tinycbor/SConscript
extlibs/wksxmppxep/SConscript
java/SConscript
plugins/src/SConscript
plugins/zigbee_wrapper/SConscript
plugins/zigbee_wrapper/src/SConscript
plugins/zigbee_wrapper/telegesis_wrapper/SConscript
plugins/zigbee_wrapper/telegesis_wrapper/src/SConscript
resource/c_common/SConscript
resource/csdk/connectivity/SConscript
resource/csdk/connectivity/build/SConscript
resource/csdk/connectivity/build/android/SConscript
resource/csdk/connectivity/build/arduino/SConscript
resource/csdk/connectivity/build/linux/SConscript
resource/csdk/connectivity/build/tizen/SConscript
resource/csdk/connectivity/build/tizen/scons/SConscript
resource/csdk/connectivity/common/SConscript
resource/csdk/connectivity/src/SConscript
resource/csdk/connectivity/src/bt_edr_adapter/SConscript
resource/csdk/connectivity/src/bt_le_adapter/SConscript
resource/csdk/connectivity/src/ip_adapter/SConscript
resource/csdk/connectivity/src/nfc_adapter/SConscript
resource/csdk/connectivity/src/ra_adapter/SConscript
resource/csdk/connectivity/src/tcp_adapter/SConscript
resource/csdk/connectivity/src/tcp_adapter/arduino/SConscript
resource/csdk/connectivity/util/SConscript
resource/csdk/security/provisioning/unittest/SConscript
resource/csdk/stack/samples/arduino/SimpleClientServer/ocserver/SConscript
resource/csdk/stack/samples/tizen/SimpleClientServer/SConscript
resource/csdk/stack/samples/tizen/SimpleClientServer/scons/SConscript
resource/csdk/stack/samples/tizen/build/SConscript
resource/csdk/stack/samples/tizen/build/scons/SConscript
resource/examples/SConscript
resource/provisioning/examples/SConscript
resource/provisioning/unittests/SConscript
resource/third_party_libs.scons
service/easy-setup/mediator/richsdk/SConscript
service/easy-setup/mediator/richsdk/android/SConscript
service/easy-setup/sampleapp/enrollee/arduino/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript
service/easy-setup/sampleapp/mediator/android/SConscript
service/notification/android/SConscript
service/notification/examples/android/NotiConsumerExample/SConscript
service/notification/examples/android/NotiProviderExample/SConscript
service/resource-container/SConscript
service/resource-container/android/SConscript
service/resource-container/unittests/SConscript
service/resource-encapsulation/android/SConscript
service/third_party_libs.scons