blob: 12c8e328a1f1fd042050e6999f8a1a2f3ecb3207 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
--- contrib/python/py/py3/py/_vendored_packages/iniconfig/__init__.py (working tree)
+++ contrib/python/py/py3/py/_vendored_packages/iniconfig/__init__.py (index)
@@ -1,6 +1,8 @@
""" brain-dead simple parser for ini-style files.
(C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed
"""
+import io
+
__all__ = ['IniConfig', 'ParseError']
COMMENTCHARS = "#;"
@@ -49,7 +51,14 @@
def __init__(self, path, data=None):
self.path = str(path) # convenience
if data is None:
- f = open(self.path)
+ if self.path.startswith('pkg:'):
+ import pkgutil
+
+ _, package, resource = self.path.split(':')
+ content = pkgutil.get_data(package, resource)
+ f = io.StringIO(content.decode('utf-8'))
+ else:
+ f = open(self.path)
try:
tokens = self._parse(iter(f))
finally:
|