comparison mercurial/utils/resourceutil.py @ 51700:7f0cb9ee0534

Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 23 Jul 2024 10:02:46 +0200
parents 493034cc3265
children ca7bde5dbafb
comparison
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
50 def _package_path(package: bytes) -> bytes: 50 def _package_path(package: bytes) -> bytes:
51 dirs = package.split(b".") 51 dirs = package.split(b".")
52 assert dirs[0] == b"mercurial" 52 assert dirs[0] == b"mercurial"
53 return os.path.join(_rootpath, *dirs[1:]) 53 return os.path.join(_rootpath, *dirs[1:])
54 54
55
55 else: 56 else:
56 datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__))) 57 datapath = os.path.dirname(os.path.dirname(pycompat.fsencode(__file__)))
57 _rootpath = os.path.dirname(datapath) 58 _rootpath = os.path.dirname(datapath)
58 59
59 def _package_path(package: bytes) -> bytes: 60 def _package_path(package: bytes) -> bytes:
95 path = pycompat.fsdecode(_package_path(package)) 96 path = pycompat.fsdecode(_package_path(package))
96 97
97 for p in os.listdir(path): 98 for p in os.listdir(path):
98 yield pycompat.fsencode(p) 99 yield pycompat.fsencode(p)
99 100
101
100 else: 102 else:
101 from .. import encoding 103 from .. import encoding
102 104
103 def open_resource(package: bytes, name: bytes) -> "BinaryIO": 105 def open_resource(package: bytes, name: bytes) -> "BinaryIO":
104 if hasattr(resources, 'files'): 106 if hasattr(resources, 'files'):