summaryrefslogtreecommitdiffstats
path: root/bin/ebuild
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-10-11 11:28:18 -0700
committerZac Medico <zmedico@gentoo.org>2011-10-11 11:28:51 -0700
commit601f819deef7da3af2101ce9e85cb8804355dffa (patch)
treeb9b90d106454b3be93feb06c8627e2d26e81bbfe /bin/ebuild
parent86e3ed5b8d1efdd439415cb3dec2905e5de058dc (diff)
downloadportage-601f819deef7da3af2101ce9e85cb8804355dffa.tar.gz
portage-601f819deef7da3af2101ce9e85cb8804355dffa.tar.bz2
portage-601f819deef7da3af2101ce9e85cb8804355dffa.zip
bin/ebuild: add --version option
Diffstat (limited to 'bin/ebuild')
-rwxr-xr-xbin/ebuild12
1 files changed, 9 insertions, 3 deletions
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:])