summaryrefslogtreecommitdiffstats
path: root/pym/_emerge/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/_emerge/main.py')
-rw-r--r--pym/_emerge/main.py74
1 files changed, 69 insertions, 5 deletions
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index fbdcc58f5..ca3857051 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -52,7 +52,6 @@ options=[
"--digest",
"--emptytree",
"--fetchonly", "--fetch-all-uri",
-"--getbinpkg", "--getbinpkgonly",
"--ignore-default-opts",
"--keep-going",
"--noconfmem",
@@ -65,7 +64,6 @@ options=[
"--skipfirst",
"--tree",
"--update",
-"--usepkg", "--usepkgonly",
"--verbose",
]
@@ -77,9 +75,7 @@ shortmapping={
"d":"--debug",
"e":"--emptytree",
"f":"--fetchonly", "F":"--fetch-all-uri",
-"g":"--getbinpkg", "G":"--getbinpkgonly",
"h":"--help",
-"k":"--usepkg", "K":"--usepkgonly",
"l":"--changelog",
"n":"--noreplace", "N":"--newuse",
"o":"--onlydeps", "O":"--nodeps",
@@ -386,8 +382,12 @@ def insert_optional_args(args):
'--deep' : valid_integers,
'--deselect' : ('n',),
'--binpkg-respect-use' : ('n', 'y',),
+ '--getbinpkg' : ('n',),
+ '--getbinpkgonly' : ('n',),
'--jobs' : valid_integers,
'--root-deps' : ('rdeps',),
+ '--usepkg' : ('n',),
+ '--usepkgonly' : ('n',),
}
short_arg_opts = {
@@ -395,6 +395,15 @@ def insert_optional_args(args):
'j' : valid_integers,
}
+ # Don't make things like "-kn" expand to "-k n"
+ # since existence of -n makes it too ambiguous.
+ short_arg_opts_n = {
+ 'g' : ('n',),
+ 'G' : ('n',),
+ 'k' : ('n',),
+ 'K' : ('n',),
+ }
+
arg_stack = args[:]
arg_stack.reverse()
while arg_stack:
@@ -421,6 +430,12 @@ def insert_optional_args(args):
break
if match is None:
+ for k, arg_choices in short_arg_opts_n.iteritems():
+ if k in arg:
+ match = k
+ break
+
+ if match is None:
new_args.append(arg)
continue
@@ -441,7 +456,7 @@ def insert_optional_args(args):
saved_opts = None
if arg[1:2] == match:
- if arg[2:] in arg_choices:
+ if match not in short_arg_opts_n and arg[2:] in arg_choices:
opt_arg = arg[2:]
else:
saved_opts = arg[2:]
@@ -551,6 +566,20 @@ def parse_opts(tmpcmdline, silent=False):
"choices" : ("True", "y", "n")
},
+ "--getbinpkg": {
+ "shortopt" : "-g",
+ "help" : "fetch binary packages",
+ "type" : "choice",
+ "choices" : ("True", "n")
+ },
+
+ "--getbinpkgonly": {
+ "shortopt" : "-G",
+ "help" : "fetch binary packages only",
+ "type" : "choice",
+ "choices" : ("True", "n")
+ },
+
"--root": {
"help" : "specify the target root filesystem for merging packages",
"action" : "store"
@@ -561,6 +590,21 @@ def parse_opts(tmpcmdline, silent=False):
"type" : "choice",
"choices" :("True", "rdeps")
},
+
+ "--usepkg": {
+ "shortopt" : "-k",
+ "help" : "use binary packages",
+ "type" : "choice",
+ "choices" : ("True", "n")
+ },
+
+ "--usepkgonly": {
+ "shortopt" : "-K",
+ "help" : "use only binary packages",
+ "type" : "choice",
+ "choices" : ("True", "n")
+ },
+
}
from optparse import OptionParser
@@ -606,6 +650,16 @@ def parse_opts(tmpcmdline, silent=False):
else:
myoptions.complete_graph = None
+ if myoptions.getbinpkg in ("True",):
+ myoptions.getbinpkg = True
+ else:
+ myoptions.getbinpkg = None
+
+ if myoptions.getbinpkgonly in ("True",):
+ myoptions.getbinpkgonly = True
+ else:
+ myoptions.getbinpkgonly = None
+
if myoptions.root_deps == "True":
myoptions.root_deps = True
@@ -660,6 +714,16 @@ def parse_opts(tmpcmdline, silent=False):
myoptions.load_average = load_average
+ if myoptions.usepkg in ("True",):
+ myoptions.usepkg = True
+ else:
+ myoptions.usepkg = None
+
+ if myoptions.usepkgonly in ("True",):
+ myoptions.usepkgonly = True
+ else:
+ myoptions.usepkgonly = None
+
for myopt in options:
v = getattr(myoptions, myopt.lstrip("--").replace("-", "_"))
if v: