Return-Path: X-Original-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-cloudstack-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 68C57ED18 for ; Mon, 28 Jan 2013 13:49:04 +0000 (UTC) Received: (qmail 63148 invoked by uid 500); 28 Jan 2013 13:48:59 -0000 Delivered-To: apmail-incubator-cloudstack-commits-archive@incubator.apache.org Received: (qmail 62881 invoked by uid 500); 28 Jan 2013 13:48:53 -0000 Mailing-List: contact cloudstack-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cloudstack-dev@incubator.apache.org Delivered-To: mailing list cloudstack-commits@incubator.apache.org Received: (qmail 62556 invoked by uid 99); 28 Jan 2013 13:48:50 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Jan 2013 13:48:50 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D9B088264CE; Mon, 28 Jan 2013 13:48:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tsp@apache.org To: cloudstack-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [5/12] git commit: cli: Fix cachegen aand cloudmonkey to generate api verbs, revert last commit Message-Id: <20130128134849.D9B088264CE@tyr.zones.apache.org> Date: Mon, 28 Jan 2013 13:48:49 +0000 (UTC) cli: Fix cachegen aand cloudmonkey to generate api verbs, revert last commit Fixes cachegen and reverts "mvn: fix cloudmonkey build" This reverts commit 6d3de41d4262abeedab234a08e8fb5714b69a9bf. Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/6c527ffb Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6c527ffb Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6c527ffb Branch: refs/heads/marvin-refactor-phase1 Commit: 6c527ffbbaeafd3a697f3f7bf3222e12646f7d22 Parents: 6d3de41 Author: Rohit Yadav Authored: Sun Jan 27 04:17:30 2013 -0800 Committer: Rohit Yadav Committed: Sun Jan 27 04:18:31 2013 -0800 ---------------------------------------------------------------------- tools/cli/cloudmonkey/cachegen.py | 11 ++++++++--- tools/cli/cloudmonkey/cloudmonkey.py | 2 +- tools/cli/pom.xml | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6c527ffb/tools/cli/cloudmonkey/cachegen.py ---------------------------------------------------------------------- diff --git a/tools/cli/cloudmonkey/cachegen.py b/tools/cli/cloudmonkey/cachegen.py index e03b6fd..509c0c6 100644 --- a/tools/cli/cloudmonkey/cachegen.py +++ b/tools/cli/cloudmonkey/cachegen.py @@ -16,11 +16,13 @@ # under the License. try: - from common import grammar + import re from marvin.cloudstackAPI import * from marvin import cloudstackAPI except ImportError, e: - pass + import sys + print "ImportError", e + sys.exit(1) completions = cloudstackAPI.__all__ @@ -43,9 +45,12 @@ def main(): completing commands and help docs. This reduces the overall search and cache_miss (computation) complexity from O(n) to O(1) for any valid cmd. """ + pattern = re.compile("[A-Z]") + verbs = list(set([x[:pattern.search(x).start()] for x in completions + if pattern.search(x) is not None]).difference(['cloudstack'])) # datastructure {'verb': {cmd': ['api', [params], doc, required=[]]}} cache_verbs = {} - for verb in grammar: + for verb in verbs: completions_found = filter(lambda x: x.startswith(verb), completions) cache_verbs[verb] = {} for api_name in completions_found: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6c527ffb/tools/cli/cloudmonkey/cloudmonkey.py ---------------------------------------------------------------------- diff --git a/tools/cli/cloudmonkey/cloudmonkey.py b/tools/cli/cloudmonkey/cloudmonkey.py index aabcde5..ecd0c82 100644 --- a/tools/cli/cloudmonkey/cloudmonkey.py +++ b/tools/cli/cloudmonkey/cloudmonkey.py @@ -514,7 +514,7 @@ class CloudMonkeyShell(cmd.Cmd, object): def main(): pattern = re.compile("[A-Z]") verbs = list(set([x[:pattern.search(x).start()] for x in completions - if pattern.search(x) is not None])) + if pattern.search(x) is not None]).difference(['cloudstack'])) for verb in verbs: def add_grammar(verb): def grammar_closure(self, args): http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6c527ffb/tools/cli/pom.xml ---------------------------------------------------------------------- diff --git a/tools/cli/pom.xml b/tools/cli/pom.xml index c76cd65..aba5ec3 100644 --- a/tools/cli/pom.xml +++ b/tools/cli/pom.xml @@ -72,6 +72,20 @@ + cachegen + compile + + exec + + + ${basedir}/cloudmonkey + python + + cachegen.py + + + + package compile