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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# -*- encoding: utf-8 -*-
from typing import Union, cast
import mobase
# we do not implement everything since this will do fine if we do not call anything
# from the C++ side
#
class DummyInstaller(mobase.IPluginInstallerSimple):
def isManualInstaller(self) -> bool:
return False
def priority(self) -> int:
return 10
def isArchiveSupported(self, tree: mobase.IFileTree) -> bool:
return tree.find("needed-file.txt") is not None
def install(
self,
name: mobase.GuessedString,
tree: mobase.IFileTree,
version: str,
nexus_id: int,
) -> Union[
mobase.InstallResult,
mobase.IFileTree,
tuple[mobase.InstallResult, mobase.IFileTree, str, int],
]:
if tree.find("needed-file.txt") is None:
return mobase.InstallResult.FAILED
if tree.find("extra-file.txt"):
name.update("new name")
new_tree = tree.createOrphanTree()
new_tree.move(tree, "subtree")
cast(mobase.IFileTree, new_tree.find("subtree")).remove("extra-file.txt")
return new_tree
return (mobase.InstallResult.NOT_ATTEMPTED, tree, "2.4.5", 33)
def createPlugin() -> mobase.IPlugin:
return DummyInstaller() # type: ignore
|