blob: d583d659ca668ac6c75c271078c095b92492ed6e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
--- contrib/python/iniconfig/iniconfig/__init__.py (index)
+++ contrib/python/iniconfig/iniconfig/__init__.py (working tree)
@@ -114,8 +114,16 @@ class IniConfig:
) -> None:
self.path = os.fspath(path)
if data is None:
- with open(self.path, encoding=encoding) as fp:
- data = fp.read()
+ if os.path.basename(self.path).startswith('pkg:'):
+ import pkgutil
+
+ basename = os.path.basename(self.path)
+ _, package, resource = basename.split(':')
+ content = pkgutil.get_data(package, resource)
+ data = content.decode('utf-8')
+ else:
+ with open(self.path, encoding=encoding) as fp:
+ data = fp.read()
tokens = _parse.parse_lines(self.path, data.splitlines(True))
|