mercurial/utils/resourceutil.py
changeset 44027 52f0140c2604
parent 43955 75ec46c63657
child 44028 42a897bf678c
--- a/mercurial/utils/resourceutil.py	Sat Dec 28 23:08:57 2019 -0500
+++ b/mercurial/utils/resourceutil.py	Sat Dec 28 23:35:13 2019 -0500
@@ -35,6 +35,7 @@
     datapath = os.path.dirname(pycompat.sysexecutable)
 else:
     datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__)))
+    _rootpath = os.path.dirname(datapath)
 
 try:
     from importlib import resources
@@ -43,7 +44,6 @@
     resources.open_binary  # pytype: disable=module-attr
 
     def open_resource(package, name):
-        package = b'mercurial.' + package
         return resources.open_binary(  # pytype: disable=module-attr
             pycompat.sysstr(package), pycompat.sysstr(name)
         )
@@ -52,7 +52,7 @@
 except (ImportError, AttributeError):
 
     def _package_path(package):
-        return os.path.join(datapath, *package.split(b'.'))
+        return os.path.join(_rootpath, *package.split(b'.'))
 
     def open_resource(package, name):
         path = os.path.join(_package_path(package), name)