[PATCH 1/2] waf: Remove as many sys path hacks as we can.

chrisj at rtems.org chrisj at rtems.org
Tue Feb 12 23:52:31 UTC 2019


From: Chris Johns <chrisj at rtems.org>

There are still sys.path hacks in the conf.py files. They cannot
be removed because the instance of python running the sphinx-build
command does not see our top level path hacks. I looked at using
PYTHONPATH but I could not figure out how to set a process environ
var for a waf build instance.
---
 bsp-howto/wscript        | 18 +++++++-----------
 c-user/wscript           | 18 +++++++-----------
 cpu-supplement/wscript   | 18 +++++++-----------
 develenv/wscript         | 18 +++++++-----------
 eclipse/wscript          | 18 +++++++-----------
 eng/wscript              | 18 +++++++-----------
 filesystem/wscript       | 18 +++++++-----------
 images/wscript           | 10 +++-------
 networking/wscript       | 18 +++++++-----------
 porting/wscript          | 18 +++++++-----------
 posix-compliance/wscript | 18 +++++++-----------
 posix-users/wscript      | 18 +++++++-----------
 rtemsconfig/wscript      | 18 +++++++-----------
 shell/wscript            | 18 +++++++-----------
 user/wscript             | 18 +++++++-----------
 wscript                  | 14 ++++++++++----
 16 files changed, 111 insertions(+), 165 deletions(-)

diff --git a/bsp-howto/wscript b/bsp-howto/wscript
index 1cb5736..4063cd4 100644
--- a/bsp-howto/wscript
+++ b/bsp-howto/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/c-user/wscript b/c-user/wscript
index 1cb5736..4063cd4 100644
--- a/c-user/wscript
+++ b/c-user/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/cpu-supplement/wscript b/cpu-supplement/wscript
index 1cb5736..4063cd4 100644
--- a/cpu-supplement/wscript
+++ b/cpu-supplement/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/develenv/wscript b/develenv/wscript
index 1cb5736..4063cd4 100644
--- a/develenv/wscript
+++ b/develenv/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/eclipse/wscript b/eclipse/wscript
index 1cb5736..4063cd4 100644
--- a/eclipse/wscript
+++ b/eclipse/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/eng/wscript b/eng/wscript
index 1cb5736..4063cd4 100644
--- a/eng/wscript
+++ b/eng/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/filesystem/wscript b/filesystem/wscript
index 1cb5736..4063cd4 100644
--- a/filesystem/wscript
+++ b/filesystem/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/images/wscript b/images/wscript
index 142b150..179938b 100644
--- a/images/wscript
+++ b/images/wscript
@@ -1,7 +1,3 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build_images as build
-from waf import cmd_options as options
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build_images as build
+from common.waf import cmd_options as options
diff --git a/networking/wscript b/networking/wscript
index 1cb5736..4063cd4 100644
--- a/networking/wscript
+++ b/networking/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/porting/wscript b/porting/wscript
index 1cb5736..4063cd4 100644
--- a/porting/wscript
+++ b/porting/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/posix-compliance/wscript b/posix-compliance/wscript
index 7ff4013..eae2174 100644
--- a/posix-compliance/wscript
+++ b/posix-compliance/wscript
@@ -1,14 +1,10 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as doc_build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as doc_build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
 
 import posix_rst
 
diff --git a/posix-users/wscript b/posix-users/wscript
index 1cb5736..4063cd4 100644
--- a/posix-users/wscript
+++ b/posix-users/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/rtemsconfig/wscript b/rtemsconfig/wscript
index 1cb5736..4063cd4 100644
--- a/rtemsconfig/wscript
+++ b/rtemsconfig/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/shell/wscript b/shell/wscript
index 1cb5736..4063cd4 100644
--- a/shell/wscript
+++ b/shell/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/user/wscript b/user/wscript
index 1cb5736..4063cd4 100644
--- a/user/wscript
+++ b/user/wscript
@@ -1,11 +1,7 @@
-from sys import path
-from os.path import abspath
-path.insert(0, abspath('../common/'))
-
-from waf import cmd_configure as configure
-from waf import cmd_build as build
-from waf import cmd_options as options
-from waf import spell
-from waf import cmd_spell
-from waf import linkcheck
-from waf import cmd_linkcheck
+from common.waf import cmd_configure as configure
+from common.waf import cmd_build as build
+from common.waf import cmd_options as options
+from common.waf import spell
+from common.waf import cmd_spell
+from common.waf import linkcheck
+from common.waf import cmd_linkcheck
diff --git a/wscript b/wscript
index f10fcb4..7cdda9a 100644
--- a/wscript
+++ b/wscript
@@ -5,17 +5,23 @@
 import sys
 import os.path
 
-sys.path.insert(0, os.path.abspath('common'))
-
 import waflib
-import waf as docs_waf
-import version
+
+from common import waf as docs_waf
+from common import version
 
 #
 # Branch version
 #
 rtems_major_version = '5'
 
+#
+# Set Python's system path to `common` from the top level so the
+# conf.py modules in subdirectories can be found. See xml_catalogue in
+# common/waf.py.
+#
+sys.path.append(os.path.abspath('common'))
+
 #
 # The documents to build.
 #
-- 
2.19.1



More information about the devel mailing list