Bug 1190371 - [mozrunner] make mozcrash an optional dependency of mozrunner. r=ted
authorJulien Pagès <j.parkouss@gmail.com>
Tue, 22 Sep 2015 07:14:00 +0200
changeset 268957 b2bd9c7a075d1469cb9511508ea3b554fac01d84
parent 268956 d340e3a25b9c06a5d52dccd62b87c27bfb3e3f4e
child 268958 85bf82ac6e9a21b4b5aa956f98867ec5d19b6e20
push id29567
push userkwierso@gmail.com
push dateThu, 22 Oct 2015 23:37:33 +0000
treeherdermozilla-central@3888eea6aaf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1190371
milestone44.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 1190371 - [mozrunner] make mozcrash an optional dependency of mozrunner. r=ted
testing/mozbase/mozrunner/mozrunner/base/runner.py
testing/mozbase/mozrunner/setup.py
--- a/testing/mozbase/mozrunner/mozrunner/base/runner.py
+++ b/testing/mozbase/mozrunner/mozrunner/base/runner.py
@@ -5,17 +5,20 @@
 
 from abc import ABCMeta, abstractproperty
 import os
 import subprocess
 import traceback
 
 from mozlog import get_default_logger
 from mozprocess import ProcessHandler
-import mozcrash
+try:
+    import mozcrash
+except ImportError:
+    mozcrash = None
 
 from ..application import DefaultContext
 from ..errors import RunnerNotStartedError
 
 
 class BaseRunner(object):
     """
     The base runner class for all mozrunner objects, both local and remote.
@@ -187,31 +190,37 @@ class BaseRunner(object):
         if not dump_save_path:
             dump_save_path = self.dump_save_path
 
         try:
             logger = get_default_logger()
             if logger is not None:
                 if test_name is None:
                     test_name = "runner.py"
-                self.crashed += mozcrash.log_crashes(
-                    logger,
-                    dump_directory,
-                    self.symbols_path,
-                    dump_save_path=dump_save_path,
-                    test=test_name)
+                if mozcrash:
+                    self.crashed += mozcrash.log_crashes(
+                        logger,
+                        dump_directory,
+                        self.symbols_path,
+                        dump_save_path=dump_save_path,
+                        test=test_name)
+                else:
+                    logger.warning("Can not log crashes without mozcrash")
             else:
-                crashed = mozcrash.check_for_crashes(
-                    dump_directory,
-                    self.symbols_path,
-                    dump_save_path=dump_save_path,
-                    test_name=test_name,
-                    quiet=quiet)
-                if crashed:
-                    self.crashed += 1
+                if mozcrash:
+                    crashed = mozcrash.check_for_crashes(
+                        dump_directory,
+                        self.symbols_path,
+                        dump_save_path=dump_save_path,
+                        test_name=test_name,
+                        quiet=quiet)
+                    if crashed:
+                        self.crashed += 1
+                else:
+                    logger.warning("Can not log crashes without mozcrash")
         except:
             traceback.print_exc()
 
         return self.crashed
 
     def cleanup(self):
         """
         Cleanup all runner state
--- a/testing/mozbase/mozrunner/setup.py
+++ b/testing/mozbase/mozrunner/setup.py
@@ -5,25 +5,26 @@
 import sys
 from setuptools import setup, find_packages
 
 PACKAGE_NAME = 'mozrunner'
 PACKAGE_VERSION = '6.10'
 
 desc = """Reliable start/stop/configuration of Mozilla Applications (Firefox, Thunderbird, etc.)"""
 
-deps = ['mozcrash >= 0.14',
-        'mozdevice >= 0.37',
+deps = ['mozdevice >= 0.37',
         'mozfile >= 1.0',
         'mozinfo >= 0.7',
         'mozlog >= 3.0',
         'mozprocess >= 0.22',
         'mozprofile >= 0.18',
         ]
 
+EXTRAS_REQUIRE = {'crash': ['mozcrash >= 0.14']}
+
 # we only support python 2 right now
 assert sys.version_info[0] == 2
 
 setup(name=PACKAGE_NAME,
       version=PACKAGE_VERSION,
       description=desc,
       long_description="see http://mozbase.readthedocs.org/",
       classifiers=['Environment :: Console',
@@ -39,15 +40,16 @@ setup(name=PACKAGE_NAME,
       author_email='tools@lists.mozilla.org',
       url='https://wiki.mozilla.org/Auto-tools/Projects/Mozbase',
       license='MPL 2.0',
       packages=find_packages(),
       package_data={'mozrunner': [
             'resources/metrotestharness.exe'
       ]},
       zip_safe=False,
-      install_requires = deps,
+      install_requires=deps,
+      extras_require=EXTRAS_REQUIRE,
       entry_points="""
       # -*- Entry points: -*-
       [console_scripts]
       mozrunner = mozrunner:cli
       """,
     )