From 59f30b1901227031531d196bd0dcf59990c68ec3 Mon Sep 17 00:00:00 2001 From: Pavel Kazakov Date: Sun, 12 Jan 2014 21:52:03 -0800 Subject: [PATCH] Add support for source variable expansion, bug #490896 --- pym/portage/util/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index 24553da..555ac76 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -592,9 +592,12 @@ class _getconfig_shlex(shlex.shlex): def __init__(self, portage_tolerant=False, **kwargs): shlex.shlex.__init__(self, **kwargs) self.__portage_tolerant = portage_tolerant + self.expand_map = None def sourcehook(self, newfile): try: + if self.expand_map is not None: + newfile = varexpand(newfile, self.expand_map) return shlex.shlex.sourcehook(self, newfile) except EnvironmentError as e: if e.errno == PermissionDenied.errno: @@ -695,6 +698,8 @@ def getconfig(mycfg, tolerant=False, allow_sourcing=False, expand=True, lex.quotes = portage._native_string("\"'") if allow_sourcing: lex.source = portage._native_string("source") + if expand: + lex.expand_map = expand_map while True: key = _unicode_decode(lex.get_token()) -- 1.8.3.2