From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SaU48-0001rn-LX for garchives@archives.gentoo.org; Fri, 01 Jun 2012 15:47:05 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B67C8E0700; Fri, 1 Jun 2012 15:46:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 5D723E068E for ; Fri, 1 Jun 2012 15:46:37 +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 5662E1B4010 for ; Fri, 1 Jun 2012 15:46:36 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 27592E5428 for ; Fri, 1 Jun 2012 15:46:35 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1338562569.ac0b226fd7d16dad7a4b8d30b4293fe401406c1c.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/__init__.py roverlay/config.py roverlay/const.py roverlay/descriptionfields.py roverlay/descriptionreader.py roverlay/ebuild.py roverlay/ebuildjob.py roverlay/fileio.py roverlay/tmpconst.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: ac0b226fd7d16dad7a4b8d30b4293fe401406c1c X-VCS-Branch: master Date: Fri, 1 Jun 2012 15:46:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: de33e48b-ffd7-42b4-8d01-60281b289e2c X-Archives-Hash: 79a8b3ce192c9d2ba767ec3404a0f40d commit: ac0b226fd7d16dad7a4b8d30b4293fe401406c1c Author: Andr=C3=A9 Erdmann mailerd de> AuthorDate: Fri Jun 1 14:56:09 2012 +0000 Commit: Andr=C3=A9 Erdmann mailerd de> CommitDate: Fri Jun 1 14:56:09 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/R_overlay.git= ;a=3Dcommit;h=3Dac0b226f 2012-01-06: * description field definition is now configurable modified: roverlay/__init__.py modified: roverlay/config.py new file: roverlay/const.py modified: roverlay/descriptionfields.py renamed: roverlay/fileio.py -> roverlay/descriptionreader.py modified: roverlay/ebuild.py modified: roverlay/ebuildjob.py deleted: roverlay/tmpconst.py --- roverlay/__init__.py | 5 + roverlay/config.py | 164 ++++++++++++- roverlay/const.py | 51 ++++ roverlay/descriptionfields.py | 343 ++++++++++++++++++++= +++--- roverlay/{fileio.py =3D> descriptionreader.py} | 248 ++++++------------= - roverlay/ebuild.py | 5 +- roverlay/ebuildjob.py | 15 +- roverlay/tmpconst.py | 108 -------- 8 files changed, 615 insertions(+), 324 deletions(-) diff --git a/roverlay/__init__.py b/roverlay/__init__.py index b1557ef..f50cec9 100644 --- a/roverlay/__init__.py +++ b/roverlay/__init__.py @@ -4,6 +4,11 @@ =20 import logging =20 + +from roverlay import config + +config.access().load_field_definition ( 'description_fields.conf' ) + logging.basicConfig ( level=3Dlogging.DEBUG, filename=3D'roverlay.log', diff --git a/roverlay/config.py b/roverlay/config.py index 248fc22..b0bf7a3 100644 --- a/roverlay/config.py +++ b/roverlay/config.py @@ -3,20 +3,53 @@ # Distributed under the terms of the GNU General Public License v2 =20 import sys - -from roverlay import descriptionfields +import shlex =20 try: import configparser -except ImportError: +except ImportError as running_python2: + # configparser is named ConfigParser in python2 import ConfigParser as configparser =20 + + + +from roverlay import descriptionfields +from roverlay import const + + + + def access(): + """Returns the ConfigTree.""" return ConfigTree() if ConfigTree.instance is None else ConfigTree.inst= ance +# --- end of access (...) --- + + +def get ( key, fallback_value=3DNone ): + """Searches for key in the ConfigTree and returns its value if possible= , + else fallback_value. + 'key' is a config path [
[.*]]