diff options
author | arcadia-devtools <[email protected]> | 2022-02-09 12:00:52 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 15:58:17 +0300 |
commit | 8e1413fed79d1e8036e65228af6c93399ccf5502 (patch) | |
tree | 502c9df7b2614d20541c7a2d39d390e9a51877cc /contrib/python/iniconfig/patches/01-arcadia.patch | |
parent | 6b813c17d56d1d05f92c61ddc347d0e4d358fe85 (diff) |
intermediate changes
ref:614ed510ddd3cdf86a8c5dbf19afd113397e0172
Diffstat (limited to 'contrib/python/iniconfig/patches/01-arcadia.patch')
-rw-r--r-- | contrib/python/iniconfig/patches/01-arcadia.patch | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/contrib/python/iniconfig/patches/01-arcadia.patch b/contrib/python/iniconfig/patches/01-arcadia.patch new file mode 100644 index 00000000000..16d9cd88a40 --- /dev/null +++ b/contrib/python/iniconfig/patches/01-arcadia.patch @@ -0,0 +1,26 @@ +--- contrib/python/iniconfig/iniconfig/__init__.py (index) ++++ contrib/python/iniconfig/iniconfig/__init__.py (working tree) +@@ -1,6 +1,7 @@ + """ brain-dead simple parser for ini-style files. + (C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed + """ ++import os + __all__ = ['IniConfig', 'ParseError'] + + COMMENTCHARS = "#;" +@@ -49,7 +50,14 @@ class IniConfig(object): + def __init__(self, path, data=None): + self.path = str(path) # convenience + if data is None: +- f = open(self.path) ++ if os.path.basename(self.path).startswith('pkg:'): ++ import io, 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: |