From 1ec144803fbde3f256f7ce41be906583907cc1ff Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 26 Jul 2008 09:33:28 +0000 Subject: [PATCH] Split out an apply_priorities() function to apply nice and ionice settings. svn path=/main/trunk/; revision=11198 --- pym/_emerge/__init__.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index d6bb0d382..cc7191ba4 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -12893,6 +12893,19 @@ def adjust_config(myopts, settings): settings["NOCOLOR"] = "true" settings.backup_changes("NOCOLOR") +def apply_priorities(settings): + ionice(settings) + nice(settings) + +def nice(settings): + try: + os.nice(int(settings.get("PORTAGE_NICENESS", "0"))) + except (OSError, ValueError), e: + out = portage.output.EOutput() + out.eerror("Failed to change nice value to '%s'" % \ + settings["PORTAGE_NICENESS"]) + out.eerror("%s\n" % str(e)) + def ionice(settings): ionice_cmd = settings.get("PORTAGE_IONICE_COMMAND") @@ -12953,16 +12966,6 @@ def emerge_main(): settings, trees, mtimedb = load_emerge_config() portdb = trees[settings["ROOT"]]["porttree"].dbapi - ionice(settings) - - try: - os.nice(int(settings.get("PORTAGE_NICENESS", "0"))) - except (OSError, ValueError), e: - portage.writemsg("!!! Failed to change nice value to '%s'\n" % \ - settings["PORTAGE_NICENESS"]) - portage.writemsg("!!! %s\n" % str(e)) - del e - if portage._global_updates(trees, mtimedb["updates"]): mtimedb.commit() # Reload the whole config from scratch. @@ -12991,6 +12994,8 @@ def emerge_main(): mysettings.lock() del myroot, mysettings + apply_priorities(settings) + spinner = stdout_spinner() if "candy" in settings.features: spinner.update = spinner.update_scroll -- 2.26.2