changeset 45462:e53a3d0ef416

templater: fix reading of templates in frozen binaries with py3 < 3.7 When using a frozen binary with py3 < 3.7, there's no `importlib.resources` module, so we use the code path that reads the resources from the file system. That code path expects bytes for package name and resource name. Differential Revision: https://phab.mercurial-scm.org/D9008
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 10 Sep 2020 22:00:00 -0700
parents 47d10ade5bc4
children dd9e28612468
files mercurial/templater.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Fri Sep 11 09:35:49 2020 -0700
+++ b/mercurial/templater.py	Thu Sep 10 22:00:00 2020 -0700
@@ -1105,8 +1105,8 @@
         return f, open(f, mode='rb')
 
     # Otherwise try to read it using the resources API
-    name_parts = pycompat.sysstr(name).split('/')
-    package_name = '.'.join(['mercurial', 'templates'] + name_parts[:-1])
+    name_parts = name.split(b'/')
+    package_name = b'.'.join([b'mercurial', b'templates'] + name_parts[:-1])
     return (
         name,
         resourceutil.open_resource(package_name, name_parts[-1]),