From 601f819deef7da3af2101ce9e85cb8804355dffa Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 11 Oct 2011 11:28:18 -0700 Subject: bin/ebuild: add --version option --- bin/ebuild | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'bin/ebuild') 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:]) -- cgit v1.2.3-1-g7c22