[rtems-source-builder commit] sb: Fix configparser import on Python2 in version.py.

Chris Johns chrisj at rtems.org
Thu Mar 10 03:56:40 UTC 2016


Module:    rtems-source-builder
Branch:    master
Commit:    29f23e04401c8d15b46b7153887b96559b713c12
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=29f23e04401c8d15b46b7153887b96559b713c12

Author:    Chris Johns <chrisj at rtems.org>
Date:      Thu Mar 10 14:52:25 2016 +1100

sb: Fix configparser import on Python2 in version.py.

Updates #2619.

---

 source-builder/sb-set-builder | 2 --
 source-builder/sb/version.py  | 5 ++++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/source-builder/sb-set-builder b/source-builder/sb-set-builder
index 52e122b..561199e 100755
--- a/source-builder/sb-set-builder
+++ b/source-builder/sb-set-builder
@@ -24,8 +24,6 @@ import sys, os
 base = os.path.dirname(sys.argv[0])
 sys.path.insert(0, base + '/sb')
 
-import setbuilder
-
 try:
     import setbuilder
     setbuilder.run()
diff --git a/source-builder/sb/version.py b/source-builder/sb/version.py
index 8b67b4e..07ab018 100644
--- a/source-builder/sb/version.py
+++ b/source-builder/sb/version.py
@@ -50,7 +50,10 @@ def _load_released_version_config():
     top = _top()
     for ver in [top, '..']:
         if path.exists(path.join(ver, 'VERSION')):
-            import configparser
+            try:
+                import configparser
+            except ImportError:
+                import ConfigParser as configparser
             v = configparser.SafeConfigParser()
             v.read(path.join(ver, 'VERSION'))
             return v




More information about the vc mailing list