mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge branch 'dev' into bookworm
This commit is contained in:
commit
cc39fca559
1 changed files with 14 additions and 4 deletions
|
@ -152,24 +152,34 @@ class AppResource:
|
||||||
"__APP__": self.app,
|
"__APP__": self.app,
|
||||||
"__YNH_ARCH__": system_arch(),
|
"__YNH_ARCH__": system_arch(),
|
||||||
"__YNH_DEBIAN_VERSION__": debian_version(),
|
"__YNH_DEBIAN_VERSION__": debian_version(),
|
||||||
|
"__YNH_DEBIAN_VERSION_ID__": debian_version_id(),
|
||||||
|
"__YNH_APP_UPSTREAM_VERSION__": (
|
||||||
|
manager.wanted["version"].split("~")[0]
|
||||||
|
if manager.wanted
|
||||||
|
else manager.current["version"].split("~")[0]
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
def recursive_apply(function: Callable, data: Any) -> Any:
|
def recursive_apply(function: Callable, data: Any) -> Any:
|
||||||
if isinstance(data, dict): # FIXME: hashable?
|
if isinstance(data, dict): # FIXME: hashable?
|
||||||
return {key: recursive_apply(value, function) for key, value in data.items()}
|
return {
|
||||||
|
key: recursive_apply(function, value) for key, value in data.items()
|
||||||
|
}
|
||||||
|
|
||||||
if isinstance(data, list): # FIXME: iterable?
|
if isinstance(data, list): # FIXME: iterable?
|
||||||
return [recursive_apply(value, function) for value in data]
|
return [recursive_apply(function, value) for value in data]
|
||||||
|
|
||||||
return function(data)
|
return function(data)
|
||||||
|
|
||||||
def replace_tokens_in_strings(data: Any):
|
def replace_tokens_in_strings(data: Any):
|
||||||
if not isinstance(data, str):
|
if not isinstance(data, str):
|
||||||
return
|
return data
|
||||||
for token, replacement in replacements.items():
|
for token, replacement in replacements.items():
|
||||||
data = data.replace(token, replacement)
|
data = data.replace(token, replacement)
|
||||||
|
|
||||||
recursive_apply(replace_tokens_in_strings, properties)
|
return data
|
||||||
|
|
||||||
|
properties = recursive_apply(replace_tokens_in_strings, properties)
|
||||||
|
|
||||||
for key, value in properties.items():
|
for key, value in properties.items():
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
|
|
Loading…
Add table
Reference in a new issue