wizlib 3.2.0__tar.gz → 3.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of wizlib might be problematic. Click here for more details.
- {wizlib-3.2.0 → wizlib-3.3.0}/PKG-INFO +2 -2
- {wizlib-3.2.0 → wizlib-3.3.0}/pyproject.toml +1 -1
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/config_handler.py +20 -2
- {wizlib-3.2.0 → wizlib-3.3.0}/README.md +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/__init__.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/app.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/class_family.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/command.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/error.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/handler.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/io.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/parser.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/stream_handler.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/super_wrapper.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/test_case.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/ui/__init__.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/ui/shell/__init__.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/ui/shell/line_editor.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/ui/shell_ui.py +0 -0
- {wizlib-3.2.0 → wizlib-3.3.0}/wizlib/ui_handler.py +0 -0
|
@@ -2,6 +2,9 @@ from argparse import Namespace
|
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
import os
|
|
4
4
|
from dataclasses import dataclass
|
|
5
|
+
import re
|
|
6
|
+
import shlex
|
|
7
|
+
import subprocess
|
|
5
8
|
from unittest.mock import patch
|
|
6
9
|
|
|
7
10
|
from yaml import load
|
|
@@ -72,8 +75,9 @@ class ConfigHandler(Handler):
|
|
|
72
75
|
while (val := split.pop(0)) and (val in yaml):
|
|
73
76
|
yaml = yaml[val] if val in yaml else None
|
|
74
77
|
if not split:
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
result = evaluate_yaml_value(yaml)
|
|
79
|
+
self.cache[key] = result
|
|
80
|
+
return result
|
|
77
81
|
|
|
78
82
|
@classmethod
|
|
79
83
|
def fake(cls, **vals):
|
|
@@ -81,3 +85,17 @@ class ConfigHandler(Handler):
|
|
|
81
85
|
self = cls()
|
|
82
86
|
self.cache = {k.replace('_', '-'): vals[k] for k in vals}
|
|
83
87
|
return self
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def os_process(match):
|
|
91
|
+
"""Run a subprocess"""
|
|
92
|
+
command_string = match.group(1).strip()
|
|
93
|
+
command = shlex.split(command_string)
|
|
94
|
+
result = subprocess.run(command, capture_output=True)
|
|
95
|
+
return result.stdout.decode().strip()
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def evaluate_yaml_value(yaml: str) -> str:
|
|
99
|
+
"""When getting a value from YAML, evaluate shell commands"""
|
|
100
|
+
text = yaml.strip()
|
|
101
|
+
return re.sub(r'\$\((.*?)\)', os_process, text)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|