Fix a bug in build_externals, it wasn't updating PYTHONPATH
Fix a bug in build_externals, it wasn't updating PYTHONPATH so the
launched python processes to run setup.py and such were not seeing the
site-packages directory. This prevented matplotlib from seeing the
just built and installed numpy module.
This bug was introduced when the 'import common' was added to this
module as that already inserted site-packages into sys.path.
Signed-off-by: Gregory Smith <gps@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3879 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/utils/build_externals.py b/utils/build_externals.py
index d5e6cf8..c452304 100755
--- a/utils/build_externals.py
+++ b/utils/build_externals.py
@@ -61,13 +61,16 @@
package_dir = os.path.join(top_of_tree, PACKAGE_DIR)
install_dir = os.path.join(top_of_tree, INSTALL_DIR)
+ # Make sure the install_dir is in our python module search path
+ # as well as the PYTHONPATH being used by all our setup.py
+ # install subprocesses.
if install_dir not in sys.path:
- # Make sure the install_dir is in our python module search path
- # as well as the PYTHONPATH being used by all our setup.py
- # install subprocesses.
sys.path.insert(0, install_dir)
- os.environ['PYTHONPATH'] = ':'.join([
- install_dir, os.environ.get('PYTHONPATH', '')])
+ env_python_path_varname = 'PYTHONPATH'
+ env_python_path = os.environ.get(env_python_path_varname, '')
+ if install_dir+':' not in env_python_path:
+ os.environ[env_python_path_varname] = ':'.join([
+ install_dir, env_python_path])
fetched_packages, fetch_errors = fetch_necessary_packages(package_dir,
install_dir)