Bug 882461 - add mozbase packages to sys.path in automation, r=jhammel
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Mon, 17 Jun 2013 13:22:39 -0700
changeset 146848 bb0567fbb4cce547f892669c0cbb1f2b933a8314
parent 146847 5a43a331c2cc70f9666f8f6f1217f91de26d58b5
child 146849 1fae83d70978705b7fcc62ced1302c69df52b106
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhammel
bugs882461
milestone24.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 882461 - add mozbase packages to sys.path in automation, r=jhammel
build/automation.py.in
testing/xpcshell/runxpcshelltests.py
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -25,27 +25,22 @@ sys.path.insert(0, SCRIPT_DIR)
 import automationutils
 
 # --------------------------------------------------------------
 # TODO: this is a hack for mozbase without virtualenv, remove with bug 849900
 #
 here = os.path.dirname(__file__)
 mozbase = os.path.realpath(os.path.join(os.path.dirname(here), 'mozbase'))
 
-try:
-    import mozcrash
-except:
-    deps = ['mozcrash',
-            'mozfile',
-            'mozlog']
-    for dep in deps:
-        module = os.path.join(mozbase, dep)
-        if module not in sys.path:
-            sys.path.append(module)
-    import mozcrash
+if os.path.isdir(mozbase):
+    for package in os.listdir(mozbase):
+        sys.path.append(os.path.join(mozbase, package))
+
+import mozcrash
+
 # ---------------------------------------------------------------
 
 _DEFAULT_PREFERENCE_FILE = os.path.join(SCRIPT_DIR, 'prefs_general.js')
 
 _DEFAULT_WEB_SERVER = "127.0.0.1"
 _DEFAULT_HTTP_PORT = 8888
 _DEFAULT_SSL_PORT = 4443
 _DEFAULT_WEBSOCKET_PORT = 9988
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -6,45 +6,38 @@
 
 import re, sys, os, os.path, logging, shutil, signal, math, time, traceback
 import xml.dom.minidom
 from glob import glob
 from optparse import OptionParser
 from subprocess import Popen, PIPE, STDOUT
 from tempfile import mkdtemp, gettempdir
 from threading import Timer
-import mozinfo
 import random
 import socket
 import time
 
 from automation import Automation, getGlobalLog, resetGlobalLog
 from automationutils import *
 
 HARNESS_TIMEOUT = 5 * 60
 
 # --------------------------------------------------------------
 # TODO: this is a hack for mozbase without virtualenv, remove with bug 849900
 #
 here = os.path.dirname(__file__)
 mozbase = os.path.realpath(os.path.join(os.path.dirname(here), 'mozbase'))
 
-# hand enumerate our own deps
-modules = [('mozcrash', ['mozcrash', 'mozfile', 'mozlog']),
-           ('manifestparser', ['manifestdestiny'])]
+if os.path.isdir(mozbase):
+    for package in os.listdir(mozbase):
+        sys.path.append(os.path.join(mozbase, package))
 
-for module, deps in modules:
-    try:
-        globals()[module] = __import__(module)
-    except ImportError:
-        for dep in deps:
-            module_path = os.path.join(mozbase, dep)
-            if module_path not in sys.path:
-                sys.path.append(module_path)
-        globals()[module] = __import__(module)
+import manifestparser
+import mozcrash
+import mozinfo
 
 # ---------------------------------------------------------------
 #TODO: replace this with json.loads when Python 2.6 is required.
 def parse_json(j):
     """
     Awful hack to parse a restricted subset of JSON strings into Python dicts.
     """
     return eval(j, {'true':True,'false':False,'null':None})