From patchwork Fri May 9 14:58:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 347439 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 5CC6314008A for ; Sat, 10 May 2014 00:58:54 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A00488C8F5; Fri, 9 May 2014 14:58:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iFuLZrd4jFI6; Fri, 9 May 2014 14:58:51 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 7E2068C71B; Fri, 9 May 2014 14:58:42 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 352891CE6EA for ; Fri, 9 May 2014 14:58:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 318E989C97 for ; Fri, 9 May 2014 14:58:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5yqFnGlfUsyM for ; Fri, 9 May 2014 14:58:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f175.google.com (mail-we0-f175.google.com [74.125.82.175]) by hemlock.osuosl.org (Postfix) with ESMTPS id 7D4C289A9B for ; Fri, 9 May 2014 14:58:37 +0000 (UTC) Received: by mail-we0-f175.google.com with SMTP id t61so4024427wes.20 for ; Fri, 09 May 2014 07:58:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=7QUx2juYXid+D23X7K+IBqZUVVrwJyzj7wdCgvjUWOU=; b=oO15QBJukPcYNvOMYOc9ZJYKBdBsN6aNRIBTm46lc+spS0/hO7Co+f4OzIrr1bZmu7 1evyfrlH19l+ZxYKDsXpAg2ojYFatggyf1I25hPTgdrH6axtGcKVRtmY3/gavur4gJDe UtneK9uXZTemJ3b+JVfsi8eX3s2Nz3YSiV525dHMqJy8MF7UbyF0ODssiGuzgUAT5qRm jr9JjJ8b6NtWTMvdHCk06kXx8438Sy8k6z91+Cu6StMTyLMzY+QjZ3hQx808sV8L4aJq 5EK2MA22lZsKbPgWGPrfPS9cmgdS+ir+rMzPAYa12e4BER4hXmUXYQARzmzLVQIVLap7 zcSg== X-Received: by 10.180.73.140 with SMTP id l12mr3798034wiv.3.1399647515843; Fri, 09 May 2014 07:58:35 -0700 (PDT) Received: from gourin.bzh.lan (ks3095497.kimsufi.com. [94.23.60.27]) by mx.google.com with ESMTPSA id pl6sm5776351wjc.0.2014.05.09.07.58.34 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 09 May 2014 07:58:35 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Fri, 9 May 2014 16:58:25 +0200 Message-Id: <0d0c04b84d1b891eab25b0a9df223679a00fd95f.1399647182.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: References: Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH 5/7] graph-depends: rename the mode constants X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net From: "Yann E. MORIN" This is ugly, since Python does not have enum constructs, so by moving the 'type' of the constant ('MODE' here) to the beginning, we get an artificial 'namespace' for the constants. Signed-off-by: "Yann E. MORIN" --- support/scripts/graph-depends | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends index 3bffec0..328f284 100755 --- a/support/scripts/graph-depends +++ b/support/scripts/graph-depends @@ -25,13 +25,9 @@ import sys import subprocess import argparse -# In FULL_MODE, we draw the full dependency graph for all selected -# packages -FULL_MODE = 1 - -# In PKG_MODE, we only draw the dependency graph for a given package -PKG_MODE = 2 - +# Modes of operation: +MODE_FULL = 1 # draw full dependency graph for all selected packages +MODE_PKG = 2 # draw dependency graph for a given package mode = 0 # Limit drawing the dependency graph to this depth. 0 means 'no limit'. @@ -53,9 +49,9 @@ parser.set_defaults(transitive=True) args = parser.parse_args() if args.package is None: - mode = FULL_MODE + mode = MODE_FULL else: - mode = PKG_MODE + mode = MODE_PKG rootpkg = args.package max_depth = int(args.depth) @@ -167,7 +163,7 @@ TARGET_EXCEPTIONS = [ # In full mode, start with the result of get_targets() to get the main # targets and then use get_all_depends() for all targets -if mode == FULL_MODE: +if mode == MODE_FULL: targets = get_targets() dependencies = [] allpkgs.append('all') @@ -185,7 +181,7 @@ if mode == FULL_MODE: # In pkg mode, start directly with get_all_depends() on the requested # package -elif mode == PKG_MODE: +elif mode == MODE_PKG: dependencies = get_all_depends([rootpkg]) # Make the dependencies a dictionnary { 'pkg':[dep1, dep2, ...] } @@ -253,7 +249,7 @@ def print_attrs(pkg): print "all [color=lightblue,style=filled]" return print "%s [label = \"%s\"]" % (pkg_node_name(pkg), pkg) - if mode == PKG_MODE and pkg == rootpkg: + if mode == MODE_PKG and pkg == rootpkg: print "%s [color=lightblue,style=filled]" % pkg_node_name(rootpkg) else: print "%s [color=grey,style=filled]" % pkg_node_name(pkg)