summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2014-07-25 13:54:55 (GMT)
committerRichard Maw <richard.maw@codethink.co.uk>2014-07-25 13:54:55 (GMT)
commite1bc560426dd9aeb953fe7ae41ef7c251855b755 (patch)
tree4eedc345d78acd5dfcd4dd0e817dddc42cd9eb9e /morphlib
parente8adedb8f3f27d9212caf277b8e8f7c6792a20c2 (diff)
downloadmorph-e1bc560426dd9aeb953fe7ae41ef7c251855b755.tar.gz
StagingArea: Ensure staging are paths are bytestringsbaserock/richardmaw/bugfix/distbuild-eglibc
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.
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/stagingarea.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/morphlib/stagingarea.py b/morphlib/stagingarea.py
index 124edab..0126b4d 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