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 173031381F3 for ; Thu, 11 Jul 2013 16:45:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 08B2EE0AA6; Thu, 11 Jul 2013 16:44:24 +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 3B4B1E0AA6 for ; Thu, 11 Jul 2013 16:44:23 +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 1958733E9F6 for ; Thu, 11 Jul 2013 16:44:22 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id A1F92E5468 for ; Thu, 11 Jul 2013 16:44:19 +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: <1373559971.384456170719b57f0dbdcefa5344eb74213bd09a.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/entrymap.py roverlay/config/entryutil.py X-VCS-Directories: roverlay/config/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 384456170719b57f0dbdcefa5344eb74213bd09a X-VCS-Branch: gsoc13/next Date: Thu, 11 Jul 2013 16:44:19 +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: d34dfc43-ce22-49ff-8bb9-16976cdfe654 X-Archives-Hash: c3dcd352c6ba5b11a26218eb202a7718 Message-ID: <20130711164419.7ULnO8qZHYpjAF3C5f946r0TrYD2oCoSJAREVMcIObU@z> commit: 384456170719b57f0dbdcefa5344eb74213bd09a Author: André Erdmann mailerd de> AuthorDate: Thu Jul 11 16:26:11 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Thu Jul 11 16:26:11 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=38445617 roverlay/config: update description --- roverlay/config/entrymap.py | 27 +++++++++++++------------- roverlay/config/entryutil.py | 45 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 55 insertions(+), 17 deletions(-) diff --git a/roverlay/config/entrymap.py b/roverlay/config/entrymap.py index 35f1e66..de29ca7 100644 --- a/roverlay/config/entrymap.py +++ b/roverlay/config/entrymap.py @@ -224,9 +224,9 @@ CONFIG_ENTRY_MAP = dict ( ), overlay_dir = dict ( value_type = 'fs_abs:fs_dir', - description = '''overlay root directory where the - ebuilds, profiles/ dir, etc. will be written to. - ''' + description = ( + 'this is the directory of the overlay to be created/maintained' + ), ), overlay_additions_dir = dict ( @@ -274,11 +274,11 @@ CONFIG_ENTRY_MAP = dict ( overlay_distdir_root = dict ( value_type = 'fs_dir', - description = ''' - DISTDIR which is used for Manifest creation and can, - depending on the DISTDIR strategy, - serve as package mirror directory. - ''' + description = ( + 'this is the directory where hard/symbolic links ' + 'to all package files will be created ' + '(during Manifest file creation)' + ), ), overlay_distdir_strategy = dict ( @@ -376,9 +376,10 @@ CONFIG_ENTRY_MAP = dict ( # they specify another location distfiles_root = dict ( value_type = 'fs_dir', - description = '''distfiles root, - repos will create their distdirs in this directory. - ''', + description = ( + 'this is the directory where per-repo package directories ' + 'will be created' + ), ), # the repo config file(s) @@ -447,7 +448,7 @@ CONFIG_ENTRY_MAP = dict ( package_rule_files = dict ( path = [ 'PACKAGE_RULES', 'files' ], value_type = fs_abslist, - description = 'list of package rule files', + description = 'list of package rule files/dirs', ), # * alias @@ -502,7 +503,7 @@ CONFIG_ENTRY_MAP = dict ( license_map = dict ( path = [ 'LICENSEMAP', 'file', ], value_type = 'fs_file', - description = None, + description = 'dictionary file for translating license strings', ) # --- other diff --git a/roverlay/config/entryutil.py b/roverlay/config/entryutil.py index 1c6b7ea..cd5f230 100644 --- a/roverlay/config/entryutil.py +++ b/roverlay/config/entryutil.py @@ -13,6 +13,41 @@ import textwrap from roverlay.config.entrymap import CONFIG_ENTRY_MAP +def deref_entry ( name ): + entry_name = name.lower() + entry_next = CONFIG_ENTRY_MAP [entry_name] + while isinstance ( entry_next, str ): + entry_name = entry_next + entry_next = CONFIG_ENTRY_MAP [entry_name] + return ( entry_name, entry_next ) +# --- end of deref_entry (...) --- + +def deref_entry_safe ( name ): + visited = set() + entry_name = name.lower() + entry_next = CONFIG_ENTRY_MAP [entry_name] + + while isinstance ( entry_next, str ): + visited.add ( entry_name ) + entry_name = entry_next + entry_next = CONFIG_ENTRY_MAP [entry_name] + + if entry_name in visited: + raise Exception ( + "cyclic config entry detected for {!r}!".format ( name ) + ) + + return ( entry_name, entry_next ) +# --- end of deref_entry_safe (...) --- + +def find_config_path ( name ): + entry_name, entry = deref_entry_safe ( name ) + try: + return entry ['path'] + except KeyError: + return entry_name.split ( '_' ) +# --- end of find_config_path (...) --- + def _iter_entries(): """Iterates through all entries in CONFIG_ENTRY_MAP and yields config entry information (entry name, description). @@ -23,10 +58,12 @@ def _iter_entries(): # entry is disabled pass elif isinstance ( entry, dict ): - if 'description' in entry: - yield ( name, entry ['description'] ) - elif 'desc' in entry: - yield ( name, entry ['desc'] ) + description = entry.get ( 'description' ) or entry.get ( 'desc' ) + if description: + if isinstance ( description, str ): + yield ( name, description ) + else: + yield ( name, '\n'.join ( map ( str, description ) ) ) else: yield ( name, ) elif isinstance ( entry, str ) and entry: