blob: 30edeae6be58849f6fb7565a6b1103bce8b0a8da (
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
|
diff --git a/lib/portage/util/__init__.py b/lib/portage/util/__init__.py
index 285bf66..74e3232 100644
--- a/lib/portage/util/__init__.py
+++ b/lib/portage/util/__init__.py
@@ -992,6 +992,20 @@ def varexpand(mystring, mydict=None, error_leader=None):
newstring.append(current)
continue
+ if mystring[pos] == "(":
+ # print(f"[šijanec.eu] debug0 {mystring}");
+ end = mystring[pos:].find(")")
+ if end == -1:
+ msg = error_leader() + "[šijanec.eu] missing closing ) in shell command substitution variable"
+ writemsg(msg + "\n", noiselevel=-1)
+ return ""
+ cmd = mystring[pos+1:pos+end]
+ out = subprocess.run(["sh", "-c", cmd], stdout=subprocess.PIPE).stdout.decode("utf-8")
+ newstring.append(out.strip())
+ pos += end+1
+ # print(f"[šijanec.eu] debug {cmd} {newstring}")
+ continue
+
if mystring[pos] == "{":
pos += 1
if pos == length:
|