summaryrefslogtreecommitdiffstats
path: root/pym/_emerge
diff options
context:
space:
mode:
Diffstat (limited to 'pym/_emerge')
-rw-r--r--pym/_emerge/help.py57
-rw-r--r--pym/_emerge/main.py117
2 files changed, 99 insertions, 75 deletions
diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py
index 97562ab3b..ab8985d45 100644
--- a/pym/_emerge/help.py
+++ b/pym/_emerge/help.py
@@ -112,7 +112,8 @@ def help(myopts, havecolor=1):
for line in wrap(paragraph, desc_width):
print(desc_indent + line)
print()
- print(" " + green("--deselect") + "[=%s]" % turquoise("n"))
+ print(" " + green("--deselect") + " [ %s | %s ]" % \
+ (turquoise("y"), turquoise("n")))
paragraph = \
"Remove atoms and/or sets from the world file. This action is implied " + \
@@ -299,7 +300,8 @@ def help(myopts, havecolor=1):
for line in wrap(desc, desc_width):
print(desc_indent + line)
print()
- print(" " + green("--autounmask") + "[=%s]" % turquoise("n"))
+ print(" " + green("--autounmask") + " [ %s | %s ]" % \
+ (turquoise("y"), turquoise("n")))
desc = "Automatically unmask packages. If any configuration " + \
"changes are required, then they will be displayed " + \
"after the merge list and emerge will immediately " + \
@@ -318,14 +320,16 @@ def help(myopts, havecolor=1):
for line in wrap(desc, desc_width):
print(desc_indent + line)
print()
- print(" " + green("--binpkg-respect-use") + \
- " < " + turquoise("y") + " | " + turquoise("n") + " >")
+ print(" " + green("--binpkg-respect-use") + " [ %s | %s ]" % \
+ (turquoise("y"), turquoise("n")))
desc = "Tells emerge to ignore binary packages if their use flags" + \
" don't match the current configuration. (default: 'n')"
for line in wrap(desc, desc_width):
print(desc_indent + line)
print()
- print(" "+green("--buildpkg") + "[=%s]" % turquoise("n") + " ("+green("-b")+" short option)")
+ print(" " + green("--buildpkg") + \
+ " [ %s | %s ] (%s short option)" % \
+ (turquoise("y"), turquoise("n"), green("-b")))
desc = "Tells emerge to build binary packages for all ebuilds processed in" + \
" addition to actually merging the packages. Useful for maintainers" + \
" or if you administrate multiple Gentoo Linux systems (build once," + \
@@ -362,7 +366,8 @@ def help(myopts, havecolor=1):
print(" Display the pretend output in a tabular form. Versions are")
print(" aligned vertically.")
print()
- print(" "+green("--complete-graph") + "[=%s]" % turquoise("n"))
+ print(" "+green("--complete-graph") + " [ %s | %s ]" % \
+ (turquoise("y"), turquoise("n")))
desc = "This causes emerge to consider the deep dependencies of all" + \
" packages from the world set. With this option enabled," + \
" emerge will bail out if it determines that the given operation will" + \
@@ -399,7 +404,8 @@ def help(myopts, havecolor=1):
print()
if _ENABLE_DYN_LINK_MAP:
- print(" " + green("--depclean-lib-check") + "[=%s]" % turquoise("n"))
+ print(" " + green("--depclean-lib-check") + " [ %s | %s ]" % \
+ (turquoise("y"), turquoise("n")))
desc = "Account for library link-level dependencies during " + \
"--depclean and --prune actions. This " + \
"option is enabled by default. In some cases this can " + \
@@ -423,7 +429,8 @@ def help(myopts, havecolor=1):
for line in wrap(desc, desc_width):
print(desc_indent + line)
print()
- print(" "+green("--fail-clean[=n]"))
+ print(" " + green("--fail-clean") + " [ %s | %s ]" % \
+ (turquoise("y"), turquoise("n")))
desc = "Clean up temporary files after a build failure. This is " + \
"particularly useful if you have PORTAGE_TMPDIR on " + \
"tmpfs. If this option is enabled, you probably also want " + \
@@ -442,13 +449,17 @@ def help(myopts, havecolor=1):
print(" Same as --fetchonly except that all package files, including those")
print(" not required to build the package, will be processed.")
print()
- print(" "+green("--getbinpkg")+ "[=%s]" % turquoise("n") + " ("+green("-g")+" short option)")
+ print(" " + green("--getbinpkg") + \
+ " [ %s | %s ] (%s short option)" % \
+ (turquoise("y"), turquoise("n"), green("-g")))
print(" Using the server and location defined in PORTAGE_BINHOST, portage")
print(" will download the information from each binary file there and it")
print(" will use that information to help build the dependency list. This")
print(" option implies '-k'. (Use -gK for binary-only merging.)")
print()
- print(" "+green("--getbinpkgonly")+ "[=%s]" % turquoise("n") + " ("+green("-G")+" short option)")
+ print(" " + green("--getbinpkgonly") + \
+ " [ %s | %s ] (%s short option)" % \
+ (turquoise("y"), turquoise("n"), green("-G")))
print(" This option is identical to -g, as above, except it will not use")
print(" ANY information from the local machine. All binaries will be")
print(" downloaded from the remote server without consulting packages")
@@ -467,7 +478,8 @@ def help(myopts, havecolor=1):
for line in wrap(desc, desc_width):
print(desc_indent + line)
print()
- print(" " + green("--keep-going") + "[=%s]" % turquoise("n"))
+ print(" " + green("--keep-going") + " [ %s | %s ]" % \
+ (turquoise("y"), turquoise("n")))
desc = "Continue as much as possible after " + \
"an error. When an error occurs, " + \
"dependencies are recalculated for " + \
@@ -537,7 +549,8 @@ def help(myopts, havecolor=1):
print(" Only merge (or pretend to merge) the dependencies of the")
print(" specified packages, not the packages themselves.")
print()
- print(" " + green("--package-moves") + "[=%s]" % turquoise("n"))
+ print(" " + green("--package-moves") + " [ %s | %s ]" % \
+ (turquoise("y"), turquoise("n")))
desc = "Perform package moves when necessary. This option " + \
"is enabled by default. WARNING: This option " + \
"should remain enabled under normal circumstances. " + \
@@ -575,7 +588,8 @@ def help(myopts, havecolor=1):
for line in wrap(desc, desc_width):
print(desc_indent + line)
print()
- print(" "+green("--rebuilt-binaries") + "[=%s]" % turquoise("n"))
+ print(" " + green("--rebuilt-binaries") + " [ %s | %s ]" % \
+ (turquoise("y"), turquoise("n")))
desc = "Replace installed packages with binary packages that have " + \
"been rebuilt. Rebuilds are detected by comparison of " + \
"BUILD_TIME package metadata. This option is enabled " + \
@@ -619,7 +633,8 @@ def help(myopts, havecolor=1):
for line in wrap(desc, desc_width):
print(desc_indent + line)
print()
- print(" " + green("--select") + "[=%s]" % turquoise("n"))
+ print(" " + green("--select") + " [ %s | %s ]" % \
+ (turquoise("y"), turquoise("n")))
desc = "Add specified packages to the world set (inverse of " + \
"--oneshot). This is useful if you want to " + \
"use EMERGE_DEFAULT_OPTS to make " + \
@@ -627,7 +642,8 @@ def help(myopts, havecolor=1):
for line in wrap(desc, desc_width):
print(desc_indent + line)
print()
- print(" " + green("--selective") + "[=%s]" % turquoise("n"))
+ print(" " + green("--selective") + " [ %s | %s ]" % \
+ (turquoise("y"), turquoise("n")))
desc = "This is similar to the --noreplace option, except that it " + \
"does not take precedence over options such as --newuse. " + \
"Some options, such as --update, imply --selective. " + \
@@ -673,13 +689,16 @@ def help(myopts, havecolor=1):
for line in wrap(desc, desc_width):
print(desc_indent + line)
print()
- print(" " + green("--use-ebuild-visibility") + "[=%s]" % turquoise("n"))
+ print(" " + green("--use-ebuild-visibility") + " [ %s | %s ]" % \
+ (turquoise("y"), turquoise("n")))
desc = "Use unbuilt ebuild metadata for visibility " + \
"checks on built packages."
for line in wrap(desc, desc_width):
print(desc_indent + line)
print()
- print(" "+green("--usepkg")+ "[=%s]" % turquoise("n") + " ("+green("-k")+" short option)")
+ print(" " + green("--usepkg") + \
+ " [ %s | %s ] (%s short option)" % \
+ (turquoise("y"), turquoise("n"), green("-k")))
print(" Tell emerge to use binary packages (from $PKGDIR) if they are")
print(" available, thus possibly avoiding some time-consuming compiles.")
print(" This option is useful for CD installs; you can export")
@@ -687,7 +706,9 @@ def help(myopts, havecolor=1):
print(" emerge \"pull\" binary packages from the CD in order to satisfy")
print(" dependencies.")
print()
- print(" "+green("--usepkgonly")+ "[=%s]" % turquoise("n") + " ("+green("-K")+" short option)")
+ print(" " + green("--usepkgonly") + \
+ " [ %s | %s ] (%s short option)" % \
+ (turquoise("y"), turquoise("n"), green("-K")))
print(" Like --usepkg above, except this only allows the use of binary")
print(" packages, and it will abort the emerge if the package is not")
print(" available at the time of dependency calculation.")
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index ec56e9d3d..76cf031e2 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -390,33 +390,34 @@ def insert_optional_args(args):
return False
valid_integers = valid_integers()
+ y_or_n = ('y', 'n',)
new_args = []
default_arg_opts = {
- '--autounmask' : ('n',),
- '--buildpkg' : ('n',),
- '--complete-graph' : ('n',),
+ '--autounmask' : y_or_n,
+ '--buildpkg' : y_or_n,
+ '--complete-graph' : y_or_n,
'--deep' : valid_integers,
- '--deselect' : ('n',),
- '--binpkg-respect-use' : ('n', 'y',),
- '--fail-clean' : ('n',),
- '--getbinpkg' : ('n',),
- '--getbinpkgonly' : ('n',),
+ '--deselect' : y_or_n,
+ '--binpkg-respect-use' : y_or_n,
+ '--fail-clean' : y_or_n,
+ '--getbinpkg' : y_or_n,
+ '--getbinpkgonly' : y_or_n,
'--jobs' : valid_integers,
- '--keep-going' : ('n',),
- '--package-moves' : ('n',),
- '--rebuilt-binaries' : ('n',),
+ '--keep-going' : y_or_n,
+ '--package-moves' : y_or_n,
+ '--rebuilt-binaries' : y_or_n,
'--root-deps' : ('rdeps',),
- '--select' : ('n',),
- '--selective' : ('n',),
- "--use-ebuild-visibility": ('n',),
- '--usepkg' : ('n',),
- '--usepkgonly' : ('n',),
+ '--select' : y_or_n,
+ '--selective' : y_or_n,
+ "--use-ebuild-visibility": y_or_n,
+ '--usepkg' : y_or_n,
+ '--usepkgonly' : y_or_n,
}
if _ENABLE_DYN_LINK_MAP:
- default_arg_opts['--depclean-lib-check'] = ('n',)
+ default_arg_opts['--depclean-lib-check'] = y_or_n
short_arg_opts = {
'D' : valid_integers,
@@ -426,11 +427,11 @@ def insert_optional_args(args):
# Don't make things like "-kn" expand to "-k n"
# since existence of -n makes it too ambiguous.
short_arg_opts_n = {
- 'b' : ('n',),
- 'g' : ('n',),
- 'G' : ('n',),
- 'k' : ('n',),
- 'K' : ('n',),
+ 'b' : y_or_n,
+ 'g' : y_or_n,
+ 'G' : y_or_n,
+ 'k' : y_or_n,
+ 'K' : y_or_n,
}
arg_stack = args[:]
@@ -525,12 +526,14 @@ def parse_opts(tmpcmdline, silent=False):
])
longopt_aliases = {"--cols":"--columns", "--skip-first":"--skipfirst"}
+ true_y_or_n = ("True", "y", "n")
+ true_y = ("True", "y")
argument_options = {
"--autounmask": {
"help" : "automatically unmask packages",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--accept-properties": {
@@ -550,7 +553,7 @@ def parse_opts(tmpcmdline, silent=False):
"shortopt" : "-b",
"help" : "build binary packages",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--config-root": {
@@ -566,7 +569,7 @@ def parse_opts(tmpcmdline, silent=False):
"--complete-graph": {
"help" : "completely account for all known dependencies",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--deep": {
@@ -584,7 +587,7 @@ def parse_opts(tmpcmdline, silent=False):
"--deselect": {
"help" : "remove atoms/sets from the world file",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--exclude": {
@@ -598,7 +601,7 @@ def parse_opts(tmpcmdline, silent=False):
"--fail-clean": {
"help" : "clean temp files after build failure",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--jobs": {
@@ -614,7 +617,7 @@ def parse_opts(tmpcmdline, silent=False):
"--keep-going": {
"help" : "continue as much as possible after an error",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--load-average": {
@@ -641,34 +644,34 @@ def parse_opts(tmpcmdline, silent=False):
"help" : "discard binary packages if their use flags \
don't match the current configuration",
"type" : "choice",
- "choices" : ("True", "y", "n")
+ "choices" : true_y_or_n
},
"--getbinpkg": {
"shortopt" : "-g",
"help" : "fetch binary packages",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--getbinpkgonly": {
"shortopt" : "-G",
"help" : "fetch binary packages only",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--package-moves": {
"help" : "perform package moves when necessary",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--rebuilt-binaries": {
"help" : "replace installed packages with binary " + \
"packages that have been rebuilt",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--rebuilt-binaries-timestamp": {
@@ -692,34 +695,34 @@ def parse_opts(tmpcmdline, silent=False):
"help" : "add specified packages to the world set " + \
"(inverse of --oneshot)",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--selective": {
"help" : "similar to the --noreplace but does not take " + \
"precedence over options such as --newuse",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--use-ebuild-visibility": {
"help" : "use unbuilt ebuild metadata for visibility checks on built packages",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--usepkg": {
"shortopt" : "-k",
"help" : "use binary packages",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
"--usepkgonly": {
"shortopt" : "-K",
"help" : "use only binary packages",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
},
}
@@ -728,7 +731,7 @@ def parse_opts(tmpcmdline, silent=False):
argument_options["--depclean-lib-check"] = {
"help" : "check for consumers of libraries before removing them",
"type" : "choice",
- "choices" : ("True", "n")
+ "choices" : true_y_or_n
}
from optparse import OptionParser
@@ -761,10 +764,10 @@ def parse_opts(tmpcmdline, silent=False):
myoptions, myargs = parser.parse_args(args=tmpcmdline)
- if myoptions.autounmask in ("True",):
+ if myoptions.autounmask in true_y:
myoptions.autounmask = True
- if myoptions.buildpkg in ("True",):
+ if myoptions.buildpkg in true_y:
myoptions.buildpkg = True
else:
myoptions.buildpkg = None
@@ -773,21 +776,21 @@ def parse_opts(tmpcmdline, silent=False):
myoptions.reinstall = "changed-use"
myoptions.changed_use = False
- if myoptions.deselect == "True":
+ if myoptions.deselect in true_y:
myoptions.deselect = True
- if myoptions.binpkg_respect_use in ("y", "True",):
+ if myoptions.binpkg_respect_use in true_y:
myoptions.binpkg_respect_use = True
else:
myoptions.binpkg_respect_use = None
- if myoptions.complete_graph in ("y", "True",):
+ if myoptions.complete_graph in true_y:
myoptions.complete_graph = True
else:
myoptions.complete_graph = None
if _ENABLE_DYN_LINK_MAP:
- if myoptions.depclean_lib_check in ("True",):
+ if myoptions.depclean_lib_check in true_y:
myoptions.depclean_lib_check = True
if myoptions.exclude:
@@ -815,40 +818,40 @@ def parse_opts(tmpcmdline, silent=False):
parser.error("Invalid Atom(s) in --exclude parameter: '%s' (only package names and slot atoms (with wildcards) allowed)\n" % \
(",".join(bad_atoms),))
- if myoptions.fail_clean == "True":
+ if myoptions.fail_clean in true_y:
myoptions.fail_clean = True
- if myoptions.getbinpkg in ("True",):
+ if myoptions.getbinpkg in true_y:
myoptions.getbinpkg = True
else:
myoptions.getbinpkg = None
- if myoptions.getbinpkgonly in ("True",):
+ if myoptions.getbinpkgonly in true_y:
myoptions.getbinpkgonly = True
else:
myoptions.getbinpkgonly = None
- if myoptions.keep_going in ("True",):
+ if myoptions.keep_going in true_y:
myoptions.keep_going = True
else:
myoptions.keep_going = None
- if myoptions.package_moves in ("True",):
+ if myoptions.package_moves in true_y:
myoptions.package_moves = True
- if myoptions.rebuilt_binaries in ("True",):
+ if myoptions.rebuilt_binaries in true_y:
myoptions.rebuilt_binaries = True
- if myoptions.root_deps == "True":
+ if myoptions.root_deps in true_y:
myoptions.root_deps = True
- if myoptions.select == "True":
+ if myoptions.select in true_y:
myoptions.select = True
myoptions.oneshot = False
elif myoptions.select == "n":
myoptions.oneshot = True
- if myoptions.selective == "True":
+ if myoptions.selective in true_y:
myoptions.selective = True
if myoptions.backtrack is not None:
@@ -931,17 +934,17 @@ def parse_opts(tmpcmdline, silent=False):
myoptions.rebuilt_binaries_timestamp = rebuilt_binaries_timestamp
- if myoptions.use_ebuild_visibility in ("True",):
+ if myoptions.use_ebuild_visibility in true_y:
myoptions.use_ebuild_visibility = True
else:
myoptions.use_ebuild_visibility = None
- if myoptions.usepkg in ("True",):
+ if myoptions.usepkg in true_y:
myoptions.usepkg = True
else:
myoptions.usepkg = None
- if myoptions.usepkgonly in ("True",):
+ if myoptions.usepkgonly in true_y:
myoptions.usepkgonly = True
else:
myoptions.usepkgonly = None