From patchwork Tue Mar 6 21:58:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zygmunt Krynicki X-Patchwork-Id: 7120 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id AC5E123E01 for ; Tue, 6 Mar 2012 21:58:14 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 51BA3A183CE for ; Tue, 6 Mar 2012 21:58:14 +0000 (UTC) Received: by iage36 with SMTP id e36so10263999iag.11 for ; Tue, 06 Mar 2012 13:58:13 -0800 (PST) Received: by 10.50.183.137 with SMTP id em9mr1729498igc.58.1331071093760; Tue, 06 Mar 2012 13:58:13 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.53.18 with SMTP id k18csp987ibg; Tue, 6 Mar 2012 13:58:12 -0800 (PST) Received: by 10.180.76.175 with SMTP id l15mr21944121wiw.2.1331071091963; Tue, 06 Mar 2012 13:58:11 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id em16si7316909wid.16.2012.03.06.13.58.11 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Mar 2012 13:58:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1S52OZ-0001ft-BH for ; Tue, 06 Mar 2012 21:58:11 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 46B88E042B for ; Tue, 6 Mar 2012 21:58:11 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-test X-Launchpad-Branch: ~linaro-validation/lava-test/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 125 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-test/trunk] Rev 125: Make lava-test usable inside a virtualenv. Message-Id: <20120306215811.20007.43314.launchpad@ackee.canonical.com> Date: Tue, 06 Mar 2012 21:58:11 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="14900"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: e37a5447bee1d24dbb9bc7f0b02d282643a64626 X-Gm-Message-State: ALoCoQmLi0wL6cLJ/jLQf99890KnNlEo01IQUGetA6lOBcuhHIq0MbaGbeIb3QZu9Of/TKVzuOGw Merge authors: Zygmunt Krynicki (zkrynicki) Related merge proposals: https://code.launchpad.net/~zkrynicki/lava-test/fix-annoyances/+merge/96199 proposed by: Zygmunt Krynicki (zkrynicki) review: Approve - Paul Larson (pwlars) review: Approve - Michael Hudson-Doyle (mwhudson) ------------------------------------------------------------ revno: 125 [merge] committer: Zygmunt Krynicki branch nick: trunk timestamp: Tue 2012-03-06 22:55:31 +0100 message: Make lava-test usable inside a virtualenv. modified: doc/changes.rst lava_test/commands.py lava_test/core/swprofile.py --- lp:lava-test https://code.launchpad.net/~linaro-validation/lava-test/trunk You are subscribed to branch lp:lava-test. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-test/trunk/+edit-subscription === modified file 'doc/changes.rst' --- doc/changes.rst 2012-03-06 12:59:07 +0000 +++ doc/changes.rst 2012-03-06 17:54:26 +0000 @@ -9,6 +9,8 @@ * Allow users to override ``analyzer_assigned_uuid`` by passing ``--analyzer-assigned-uuid`` to the run command. This change fixes https://bugs.launchpad.net/lava-dispatcher/+bug/934164 + * Improved error output when running inside virtualenv where the apt and + lsb_release modules are not visible to python. .. _version_0_4: === modified file 'lava_test/commands.py' --- lava_test/commands.py 2012-03-06 12:59:07 +0000 +++ lava_test/commands.py 2012-03-06 17:54:26 +0000 @@ -260,11 +260,23 @@ except RuntimeError as ex: raise LavaCommandError(str(ex)) self.say("run complete, result_id is {0!r}", artifacts.result_id) - artifacts.create_initial_bundle( - self.args.skip_software_context, - self.args.skip_hardware_context, - self.args.trusted_time, - self.args.analyzer_assigned_uuid) + try: + artifacts.create_initial_bundle( + self.args.skip_software_context, + self.args.skip_hardware_context, + self.args.trusted_time, + self.args.analyzer_assigned_uuid) + except ImportError as exc: + msg_template = ( + "Unable to probe for software context. Install the '%s'" + " package or invoke lava-test run with" + " '--skip-software-context'") + if exc.message == "No module named apt": + raise LavaCommandError(msg_template % "python-apt") + elif exc.message == "No module named lsb_release": + raise LavaCommandError(msg_template % "lsb-release") + else: + raise artifacts.save_bundle() if self.args.output: parse_results = test.parse(artifacts) === modified file 'lava_test/core/swprofile.py' --- lava_test/core/swprofile.py 2011-09-12 09:19:10 +0000 +++ lava_test/core/swprofile.py 2012-03-06 17:49:19 +0000 @@ -13,8 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import apt - from lava_test.utils import read_file @@ -23,6 +21,7 @@ apt_cache - if not provided, this will be read from the system """ + import apt if apt_cache == None: apt_cache = apt.Cache() packages = []