Skip to content

Commit

Permalink
Bug 882461 - add mozbase packages to sys.path in automation, r=jhammel
Browse files Browse the repository at this point in the history
  • Loading branch information
ahal committed Jun 17, 2013
1 parent 9e96449 commit 815d2f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
17 changes: 6 additions & 11 deletions build/automation.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,12 @@ import automationutils
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')
Expand Down
21 changes: 7 additions & 14 deletions testing/xpcshell/runxpcshelltests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from subprocess import Popen, PIPE, STDOUT
from tempfile import mkdtemp, gettempdir
from threading import Timer
import mozinfo
import random
import socket
import time
Expand All @@ -27,19 +26,13 @@
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'])]

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)
if os.path.isdir(mozbase):
for package in os.listdir(mozbase):
sys.path.append(os.path.join(mozbase, package))

import manifestparser
import mozcrash
import mozinfo

# ---------------------------------------------------------------
#TODO: replace this with json.loads when Python 2.6 is required.
Expand Down

0 comments on commit 815d2f1

Please sign in to comment.