Bug 1277087 - Change how the buildconfig module searches for config.status
So far, we relied on the module being copied over in the virtualenv, and
the module itself would try to find config.status in parent directories
of its own location. Unfortunately, this falls short when the source
tree's build/ directory appears early in the sys.path.
With this change, we don't copy the module to the virtualenv anymore,
and try to find config.status in parent directories of the python
executable, which, when running from the virtualenv, will be equivalent
to the current behavior.
--- a/build/buildconfig.py
+++ b/build/buildconfig.py
@@ -1,17 +1,17 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import imp
import os
import sys
-path = os.path.dirname(__file__)
+path = os.path.dirname(sys.executable)
while not os.path.exists(os.path.join(path, 'config.status')):
parent = os.path.normpath(os.path.join(path, os.pardir))
if parent == path:
raise Exception("Can't find config.status")
path = parent
path = os.path.join(path, 'config.status')
config = imp.load_module('_buildconfig', open(path), path, ('', 'r', imp.PY_SOURCE))
--- a/build/virtualenv_packages.txt
+++ b/build/virtualenv_packages.txt
@@ -18,17 +18,16 @@ macholib.pth:python/macholib
mock.pth:python/mock-1.0.0
mozilla.pth:build
mozilla.pth:config
mozilla.pth:xpcom/typelib/xpt/tools
mozilla.pth:dom/bindings
mozilla.pth:dom/bindings/parser
mozilla.pth:layout/tools/reftest
moztreedocs.pth:tools/docs
-copy:build/buildconfig.py
packages.txt:testing/mozbase/packages.txt
objdir:build
gyp.pth:media/webrtc/trunk/tools/gyp/pylib
pyasn1.pth:python/pyasn1
pyasn1_modules.pth:python/pyasn1-modules
bitstring.pth:python/bitstring
redo.pth:python/redo
requests.pth:python/requests