From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 101771381F3 for ; Wed, 26 Jun 2013 17:29:29 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DE3E2E08BA; Wed, 26 Jun 2013 17:29:27 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3EC26E08A1 for ; Wed, 26 Jun 2013 17:29:26 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id AC64C33E760 for ; Wed, 26 Jun 2013 17:29:25 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 58948E545E for ; Wed, 26 Jun 2013 17:29:24 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1372267347.84f3fafe99ee9e291ef09cd4b9ea0c8ec933a45b.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:gsoc13/next commit in: roverlay/config/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/config/tree.py X-VCS-Directories: roverlay/config/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 84f3fafe99ee9e291ef09cd4b9ea0c8ec933a45b X-VCS-Branch: gsoc13/next Date: Wed, 26 Jun 2013 17:29:24 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 0bb72f41-dd0a-4e34-95b1-4b12adf8857a X-Archives-Hash: b3fbf718b194024e541a1b2f161fca79 Message-ID: <20130626172924.azoy15fRhjYnBtCkRtzLS_Fz4-fVhsUb8c9ZD7xVohw@z> commit: 84f3fafe99ee9e291ef09cd4b9ea0c8ec933a45b Author: André Erdmann mailerd de> AuthorDate: Wed Jun 26 17:22:27 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Wed Jun 26 17:22:27 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=84f3fafe roverlay/config/tree, visualize(): sort entries --- roverlay/config/tree.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/roverlay/config/tree.py b/roverlay/config/tree.py index 3466889..4be20c1 100644 --- a/roverlay/config/tree.py +++ b/roverlay/config/tree.py @@ -252,12 +252,15 @@ class ConfigTree ( object ): return "{}{} is empty\n".format ( var_indent, name ) else: extra = ''.join ( [ - self._tree_to_str ( n, r, level+1 ) for r, n in root.items() + self._tree_to_str ( n, r, level+1 ) for r, n in sorted ( + root.items(), + key=lambda e: ( isinstance ( e[1], dict ), e[0] ) + ) ] ) - return "{i}{} {{\n{}{i}}}\n".format ( name, extra, i=indent ) - elif level == 1: - # non-nested config entry - return "\n{}{} = {!r}\n\n".format ( var_indent, name, root ) + return "{i}{n} {{\n{e}{i}}}\n".format ( n=name, e=extra, i=indent ) +# elif level == 1: +# # non-nested config entry +# return "\n{}{} = {!r}\n".format ( var_indent, name, root ) else: return "{}{} = {!r}\n".format ( var_indent, name, root ) # --- end of _tree_to_str (...) ---