[rtems-tools commit] waf: Add getcwd() to sys.path as waf has changed.

Chris Johns chrisj at rtems.org
Tue Apr 10 04:00:15 UTC 2018


Module:    rtems-tools
Branch:    master
Commit:    c5286cd923f7c0132c4380f481aa34546c3fcc61
Changeset: http://git.rtems.org/rtems-tools/commit/?id=c5286cd923f7c0132c4380f481aa34546c3fcc61

Author:    Chris Johns <chrisj at rtems.org>
Date:      Tue Apr 10 13:59:11 2018 +1000

waf: Add getcwd() to sys.path as waf has changed.

---

 wscript | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/wscript b/wscript
index 0a34d47..0f51f96 100644
--- a/wscript
+++ b/wscript
@@ -1,6 +1,6 @@
 #
 # RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2014-2015 Chris Johns (chrisj at rtems.org)
+# Copyright 2014-2018 Chris Johns (chrisj at rtems.org)
 # All rights reserved.
 #
 # This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -50,7 +50,18 @@ def get_version(ctx):
         v.read('VERSION')
         release = v.get('version', 'release')
     else:
-        from rtemstoolkit import git
+        #
+        # waf after 1.9.9 does not place the current directory in Python's
+        # system path which means importing the RTEMS toolkit
+        # fails. Temporarily add it so we can import the git module.
+        #
+        import sys
+        current_sys_path = sys.path
+        try:
+            sys.path = [os.getcwd()] + sys.path
+            from rtemstoolkit import git
+        finally:
+            sys.path = current_sys_path
         repo = git.repo('.')
         if repo.valid():
             head = repo.head()



More information about the vc mailing list