fix : proper update of config file (before it was discarding architectures that were not the current one) fixes #774

This commit is contained in:
alalazo 2016-04-12 16:54:51 +02:00
parent e73caad0d7
commit 80678b2188
3 changed files with 14 additions and 13 deletions

View file

@ -152,7 +152,7 @@ def main():
command = spack.cmd.get_command(args.command) command = spack.cmd.get_command(args.command)
try: try:
return_val = command(parser, args) return_val = command(parser, args)
except SpackError, e: except SpackError as e:
e.die() e.die()
except KeyboardInterrupt: except KeyboardInterrupt:
sys.stderr.write('\n') sys.stderr.write('\n')

View file

@ -22,19 +22,18 @@
# along with this program; if not, write to the Free Software Foundation, # along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
############################################################################## ##############################################################################
import sys
import argparse import argparse
import sys
import llnl.util.tty as tty import llnl.util.tty as tty
from llnl.util.tty.color import colorize
from llnl.util.tty.colify import colify
from llnl.util.lang import index_by
import spack.compilers import spack.compilers
import spack.spec
import spack.config import spack.config
from spack.util.environment import get_path import spack.spec
from llnl.util.lang import index_by
from llnl.util.tty.colify import colify
from llnl.util.tty.color import colorize
from spack.spec import CompilerSpec from spack.spec import CompilerSpec
from spack.util.environment import get_path
description = "Manage compilers" description = "Manage compilers"

View file

@ -539,14 +539,16 @@ def update_config(section, update_data, scope=None):
other yaml-ish structure. other yaml-ish structure.
""" """
# read in the config to ensure we've got current data
get_config(section)
validate_section_name(section) # validate section name validate_section_name(section) # validate section name
scope = validate_scope(scope) # get ConfigScope object from string. scope = validate_scope(scope) # get ConfigScope object from string.
# read in the config to ensure we've got current data
configuration = get_config(section)
configuration.update(update_data)
# read only the requested section's data. # read only the requested section's data.
scope.sections[section] = { section : update_data } scope.sections[section] = {section: configuration}
scope.write_section(section) scope.write_section(section)