MockModuleBuilder: fix an encoding error running under Python 2.7

This commit is contained in:
Owen W. Taylor
2020-12-01 11:23:04 -05:00
parent f5c7c6b9f4
commit 48224c7853

View File

@@ -413,8 +413,8 @@ class MockModuleBuilder(GenericBuilder):
# ...and inject modules.yaml there if asked.
if include_module_yaml:
mmd_path = os.path.join(path, "modules.yaml")
with open(mmd_path, "w") as f:
f.write(mmd_to_str(m1_mmd))
with open(mmd_path, "wb") as f:
f.write(mmd_to_str(m1_mmd).encode("utf-8"))
execute_cmd(["/usr/bin/modifyrepo_c", "--mdtype=modules", mmd_path, repodata_path])
def _add_repo(self, name, baseurl, extra=""):