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.77) (envelope-from ) id 1SmoTm-0007bf-5f for garchives@archives.gentoo.org; Thu, 05 Jul 2012 16:00:30 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4FB5DE04ED; Thu, 5 Jul 2012 16:00:13 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 229E5E04ED for ; Thu, 5 Jul 2012 16:00:12 +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 735281B40D3 for ; Thu, 5 Jul 2012 16:00:12 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 26A6CE5436 for ; Thu, 5 Jul 2012 16:00:11 +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: <1341503415.51c037ec3f153398db7f2e10c3c5961d328617b1.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: /, roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: main.py roverlay/argutil.py X-VCS-Directories: / roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 51c037ec3f153398db7f2e10c3c5961d328617b1 X-VCS-Branch: master Date: Thu, 5 Jul 2012 16:00:11 +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: e7f60084-8161-4bc7-98d6-238214e5c8ab X-Archives-Hash: c20b942fb119995662a3010f001d6541 commit: 51c037ec3f153398db7f2e10c3c5961d328617b1 Author: Andr=C3=A9 Erdmann mailerd de> AuthorDate: Thu Jul 5 15:50:15 2012 +0000 Commit: Andr=C3=A9 Erdmann mailerd de> CommitDate: Thu Jul 5 15:50:15 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/R_overlay.git= ;a=3Dcommit;h=3D51c037ec main script: --print-config modified: main.py modified: roverlay/argutil.py --- main.py | 24 ++++++++++++++++++------ roverlay/argutil.py | 12 +++++++++++- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index a4f2227..df76b32 100755 --- a/main.py +++ b/main.py @@ -1,5 +1,6 @@ #!/usr/bin/env python =20 +import os import sys =20 # roverlay modules will be imported later @@ -7,11 +8,11 @@ import sys HIDE_EXCEPTIONS =3D False =20 class DIE ( object ): - NOP =3D 0 - ERR =3D 1 - BAD_USAGE =3D 3 - ARG =3D 9 - CONFIG =3D 10 + NOP =3D os.EX_OK + ERR =3D 1 + BAD_USAGE =3D os.EX_USAGE + ARG =3D 9 + CONFIG =3D os.EX_CONFIG OV_CREATE =3D 20 SYNC =3D 30 CMD_LEFTOVER =3D 90 @@ -74,7 +75,10 @@ except ImportError: raise =20 try: - roverlay.load_config_file ( config_file, extraconf=3Dadditional_config = ) + conf =3D roverlay.load_config_file ( + config_file, + extraconf=3Dadditional_config + ) del config_file, additional_config except: if HIDE_EXCEPTIONS: @@ -82,6 +86,14 @@ except: else: raise =20 +if OPTION ( 'print_config' ): + try: + conf.visualize ( into=3Dsys.stdout ) + except: + die ( "Cannot print config!" ) + sys.exit ( os.EX_OK ) + + # -- determine commands to run # (TODO) could replace this section when adding more actions =20 diff --git a/roverlay/argutil.py b/roverlay/argutil.py index 8e37694..540743a 100644 --- a/roverlay/argutil.py +++ b/roverlay/argutil.py @@ -151,12 +151,21 @@ def get_parser ( CMD_DESC, DEFAULT_CONFIG ): **opt_in ) =20 + arg ( + '--print-config', '--pc', + help=3D"print config and exit", + **opt_in + ) + + # --write-desc + # --log-level, --log-console, --log... + # TODO arg ( '--debug', help=3D''' Turn on debugging. This produces a lot of messages. - (TODO: always on). + (TODO: has no effect). ''', **opt_in ) @@ -200,6 +209,7 @@ def parse_argv ( *args, **kw ): show_overlay =3D p.show_overlay, write_overlay =3D p.write_overlay, print_stats =3D p.stats, + print_config =3D p.print_config, force_distroot =3D p.force_distroot, ) =20