Fix KeyValuePairFileLoader to only split on '=' once and strip whitespace
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 06:34:37 +0000 (06:34 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 06:34:37 +0000 (06:34 -0000)
for keys and values. (trunk r12742)

svn path=/main/branches/2.1.6/; revision=12991

pym/portage/env/loaders.py

index b23c7f39350df22da8ea24512861005b2159b34a..53566625ce31ebac05b10efc5deefa601bd1b6fb 100644 (file)
@@ -268,14 +268,14 @@ class KeyValuePairFileLoader(FileLoader):
                        return
                if not len(line): # skip empty lines
                        return
-               split = line.split('=')
+               split = line.split('=', 1)
                if len(split) < 2:
                        errors.setdefault(self.fname, []).append(
                                "Malformed data at line: %s, data %s"
                                % (line_num + 1, line))
                        return
-               key = split[0]
-               value = split[1:]
+               key = split[0].strip()
+               value = split[1].split()
                if not key:
                        errors.setdefault(self.fname, []).append(
                                "Malformed key at line: %s, key %s"