From e1bc560426dd9aeb953fe7ae41ef7c251855b755 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Fri, 25 Jul 2014 13:54:55 +0000 Subject: StagingArea: Ensure staging are paths are bytestrings If the destdir path returned when creating a staging area is a unicode string, then when attempting to `os.walk(destdir)`, it will encounter unicode errors if there are file paths in the destdir that are not representable as unicode strings. For various as-yet unknown reasons, when building stage-2 eglibc it produces file paths that are not unicode compatible. There was previously a patch to fix this issue with regards to creating the metadata files, but it did not fix all the issues, because the build at the time was local rather than distributed. This is failing during a distributed build because morphologies are serialised into json, and during deserialisation their string values are left as unicode. Rather than doing the byte-string conversion during deserialisation, I have chosen to do it when the contents of the morphology are used, because it's only at the point where it's used to create a file path, that it matters whether it's unicode or not. --- morphlib/stagingarea.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'morphlib') diff --git a/morphlib/stagingarea.py b/morphlib/stagingarea.py index 124edabf..0126b4d9 100644 --- a/morphlib/stagingarea.py +++ b/morphlib/stagingarea.py @@ -65,8 +65,8 @@ class StagingArea(object): os.makedirs(dirname) def _dir_for_source(self, source, suffix): - dirname = os.path.join(self.dirname, - '%s.%s' % (source.morphology['name'], suffix)) + basename = '%s.%s' % (str(source.morphology['name']), suffix) + dirname = os.path.join(self.dirname, basename) self._mkdir(dirname) return dirname -- cgit v1.2.1