Skip to content
Snippets Groups Projects
Commit b99fffe3 authored by ale's avatar ale
Browse files

Allow env var substitution in include paths

parent 16cbe472
No related branches found
No related tags found
No related merge requests found
Pipeline #27262 passed
......@@ -54,9 +54,11 @@ def _make_identifier(s):
return s.replace('-', '_')
# Returns the absolute path to a file. If the given path is relative,
# it will be evaluated based on the given path_reference.
# Returns the absolute path to a file. Environment variables will be
# substituted. If the given path is relative, it will be evaluated
# based on the given path_reference.
def _abspath(path, relative_to='/'):
path = os.path.expandvars(path)
if path.startswith('/'):
return path
return os.path.abspath(os.path.join(os.path.dirname(relative_to), path))
......
......@@ -19,9 +19,11 @@ EXIT_CHANGED = 1
EXIT_ERROR = 2
# Returns the absolute path to a file. If the given path is relative,
# it will be evaluated based on the given path_reference.
# Returns the absolute path to a file. Environment variables will be
# substituted. If the given path is relative, it will be evaluated
# based on the given path_reference.
def _abspath(path, relative_to='/'):
path = os.path.expandvars(path)
if path.startswith('/'):
return path
return os.path.abspath(os.path.join(os.path.dirname(relative_to), path))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment