From patchwork Fri Aug 12 16:23:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 73857 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp253917qga; Fri, 12 Aug 2016 09:23:38 -0700 (PDT) X-Received: by 10.98.201.2 with SMTP id k2mr28446350pfg.95.1471019018119; Fri, 12 Aug 2016 09:23:38 -0700 (PDT) Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id cc15si9567719pac.249.2016.08.12.09.23.37; Fri, 12 Aug 2016 09:23:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org Received: from layers.openembedded.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id A6EFD7725E; Fri, 12 Aug 2016 16:23:29 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by mail.openembedded.org (Postfix) with ESMTP id F04C7760B0 for ; Fri, 12 Aug 2016 16:23:26 +0000 (UTC) Received: by mail-wm0-f52.google.com with SMTP id o80so44368263wme.1 for ; Fri, 12 Aug 2016 09:23:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=MuYvWx4wrg/PmtXMVETHPjkI9qM0Z1cKZtk7JAqR24Q=; b=Sv70COM1Iff9LyzBDgA5R6Hni3iDQ4cP5RMDXqMdVNy5cDYOcUARCqRPjenNK+uJ/z i70EH41pq62iWw5avsJjAZ1RZ7fZHU9RSXKuo2R7SL0mn1azgt2H9myhq0lhLkbXcciy 9kZNXsfrinkgLZrK1tB3vIJ4aMSaeDmYUbXRShDj2HLM8zNJaZSew7uh1QgZzko4fZGu xJKxGKGHCg9V3xYc90vZg8EuegV7wjrszaR8ymwpbDP1ZDvaJUuFdSK4fgW6oP6KwmvM E1bIgDKJ7SouRDQJ2EXUb/b/75H61t9ilZolnzFrzJUpzeXNMvAcjxgCH/2VNMKPUoni R7uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=MuYvWx4wrg/PmtXMVETHPjkI9qM0Z1cKZtk7JAqR24Q=; b=EsvQcFwvW55gLJnnE9NcuVAYPNeRHVsJOt2NRFGWjZIWMK7Ls+wle3BEaUtXDMKICX Uvaa3jMV4ErCvqzslUba4hbAh4pr5jkNQwJxcg1GYKn8C/E/K6TFujZQ8ouMMb+OP6BC BYg+0+9fo4mgFQ55kU5NZP5DNf9tCvb6uVFHEUr1oCpowcXfxHA8sr4n8YfL1YojsHVb Nwo1SPMZfttxhGki8mv+mVv50rb/pBSASPOMddXw2yYH8GyTtr4N405Anw4nkcSOvg/Z y4g4wC5q5zDdaD1k1+F1BFwSSFJ4cSdoK2Vo3ylWn4y33gLwAHHa3t6t0X88jHXOGrwA UTPw== X-Gm-Message-State: AEkoouu2Z7Tcrv6kumlPgnIv03euF9mzCDL+dYqcMyqFjFdHwH2Gplqp+1diYj8aGJS1vrAb X-Received: by 10.194.110.102 with SMTP id hz6mr16237204wjb.5.1471019006607; Fri, 12 Aug 2016 09:23:26 -0700 (PDT) Received: from flashheart.burtonini.com (home.burtonini.com. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id gg10sm8215523wjd.4.2016.08.12.09.23.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Aug 2016 09:23:25 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Fri, 12 Aug 2016 17:23:23 +0100 Message-Id: <1471019003-10719-1-git-send-email-ross.burton@intel.com> X-Mailer: git-send-email 2.8.1 Subject: [OE-core] [PATCH] graph-tool: update to new networkx API, be iterative X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org Update the dot parser to the new networkx API (using pydotplus to parse). Also, switch the path display to output the paths as they are found instead of collecting them into a list, so output appears sooner. Signed-off-by: Ross Burton --- scripts/contrib/graph-tool | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) -- 2.8.1 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/scripts/contrib/graph-tool b/scripts/contrib/graph-tool index 0275fbd..1df5b8c 100755 --- a/scripts/contrib/graph-tool +++ b/scripts/contrib/graph-tool @@ -30,8 +30,7 @@ def get_path_networkx(dotfile, fromnode, tonode): print('ERROR: Please install the networkx python module') sys.exit(1) - graph = networkx.DiGraph(networkx.read_dot(dotfile)) - + graph = networkx.DiGraph(networkx.nx_pydot.read_dot(dotfile)) def node_missing(node): import difflib close_matches = difflib.get_close_matches(node, graph.nodes(), cutoff=0.7) @@ -53,11 +52,11 @@ def find_paths(args, usage): fromnode = args[1] tonode = args[2] - paths = list(get_path_networkx(args[0], fromnode, tonode)) - if paths: - for path in paths: - print(" -> ".join(map(str,path))) - else: + + path = None + for path in get_path_networkx(args[0], fromnode, tonode): + print(" -> ".join(map(str, path))) + if not path: print("ERROR: no path from %s to %s in graph" % (fromnode, tonode)) sys.exit(1)