From: Zac Medico Date: Tue, 11 Oct 2011 18:28:18 +0000 (-0700) Subject: bin/ebuild: add --version option X-Git-Tag: v2.2.0_alpha67~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=601f819deef7da3af2101ce9e85cb8804355dffa;p=portage.git bin/ebuild: add --version option --- diff --git a/bin/ebuild b/bin/ebuild index 1cbdb2d7a..d4b8b71f6 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -46,6 +46,8 @@ parser.add_option("--color", help="enable or disable color output", type="choice", choices=("y", "n")) parser.add_option("--debug", help="show debug output", action="store_true", dest="debug") +parser.add_option("--version", help="show version and exit", + action="store_true", dest="version") parser.add_option("--ignore-default-opts", action="store_true", help="do not use the EBUILD_DEFAULT_OPTS environment variable") @@ -54,9 +56,6 @@ parser.add_option("--skip-manifest", help="skip all manifest checks", opts, pargs = parser.parse_args(args=sys.argv[1:]) -if len(pargs) < 2: - parser.error("missing required args") - os.environ["PORTAGE_CALLER"]="ebuild" try: import portage @@ -75,6 +74,13 @@ from portage.const import VDB_PATH from _emerge.Package import Package from _emerge.RootConfig import RootConfig +if opts.version: + print("Portage", portage.VERSION) + sys.exit(os.EX_OK) + +if len(pargs) < 2: + parser.error("missing required args") + if not opts.ignore_default_opts: default_opts = portage.settings.get("EBUILD_DEFAULT_OPTS", "").split() opts, pargs = parser.parse_args(default_opts + sys.argv[1:])