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
--- 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]),