Move to VCPKG. (#14)

This commit is contained in:
Mikaël Capelle
2025-05-29 11:02:47 +02:00
committed by GitHub
parent d2c028d240
commit c3ab38340b
7 changed files with 107 additions and 108 deletions
-6
View File
@@ -1,10 +1,4 @@
cmake_minimum_required(VERSION 3.16)
if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
else()
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
endif()
project(ScriptExtenderPluginChecker LANGUAGES NONE)
add_subdirectory(src)
+17
View File
@@ -0,0 +1,17 @@
{
"configurePresets": [
{
"binaryDir": "${sourceDir}/vsbuild",
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"generator": "Visual Studio 17 2022",
"name": "vs2022-windows"
}
],
"buildPresets": [
{
"name": "vs2022-windows",
"configurePreset": "vs2022-windows"
}
],
"version": 4
}
-38
View File
@@ -1,38 +0,0 @@
version: 1.0.{build}
skip_branch_with_pr: true
image: Visual Studio 2019
environment:
WEBHOOK_URL:
secure: gOKbXaZM9ImtMD5XrYITvdyZUW/az082G9OIN1EC1Vbg57wBaeLhi49uGjxPw5GVujHku6kxN6ab89zhbS5GVeluR76GM83IbKV4Sh7udXzoYZZdg6YudtYHzdhCgUeiedpswbuczTq9ceIkkfSEWZuh/lMAAVVwvcGsJAnoPFw=
build_script:
- pwsh: >-
$ErrorActionPreference = 'Stop'
git clone --depth=1 --no-single-branch https://github.com/ModOrganizer2/modorganizer-umbrella.git c:\projects\modorganizer-umbrella
New-Item -ItemType Directory -Path c:\projects\modorganizer-build
cd c:\projects\modorganizer-umbrella
($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH -eq $null) ? ($branch = $env:APPVEYOR_REPO_BRANCH) : ($branch = $env:APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH)
git checkout $(git show-ref --verify --quiet refs/remotes/origin/${branch} || echo '-b') ${branch}
C:\Python37-x64\python.exe unimake.py -d c:\projects\modorganizer-build -s Appveyor_Build=True ${env:APPVEYOR_PROJECT_NAME}
if($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode ) }
artifacts:
- path: src\ScriptExtenderPluginChecker.py
name: script_extender_checker_main_py
- path: src\ScriptExtenderPluginChecker_en.ts
name: script_extender_checker_translation_file
on_success:
- ps: Set-Location -Path $env:APPVEYOR_BUILD_FOLDER
- ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1
- ps: ./send.ps1 success $env:WEBHOOK_URL
on_failure:
- ps: Set-Location -Path $env:APPVEYOR_BUILD_FOLDER
- ps: Push-AppveyorArtifact ${env:APPVEYOR_BUILD_FOLDER}\stdout.log
- ps: Push-AppveyorArtifact ${env:APPVEYOR_BUILD_FOLDER}\stderr.log
- ps: Invoke-RestMethod https://raw.githubusercontent.com/DiscordHooks/appveyor-discord-webhook/master/send.ps1 -o send.ps1
- ps: ./send.ps1 failure $env:WEBHOOK_URL
+2
View File
@@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 3.16)
find_package(mo2-cmake CONFIG REQUIRED)
add_custom_target(ScriptExtenderPluginChecker ALL)
mo2_configure_python(ScriptExtenderPluginChecker SIMPLE)
+51 -42
View File
@@ -1,19 +1,18 @@
from __future__ import annotations
import re
from enum import Enum, auto
from pathlib import Path
import re
import sys
from collections import namedtuple
from typing import Callable, NamedTuple
import mobase
from PyQt6.QtCore import QCoreApplication, qDebug
if "mobase" not in sys.modules:
import mock_mobase as mobase
class PluginMessage():
class PluginMessage:
kUnknownOrigin = "<unknown>"
def __init__(self, pluginPath, organizer):
def __init__(self, pluginPath: str | Path, organizer: mobase.IOrganizer):
self._pluginPath = Path(pluginPath)
try:
self._pluginOrigin = organizer.getFileOrigins(
@@ -30,20 +29,24 @@ class PluginMessage():
def asMessage(self):
return self.tr("{0} ({1}) existed.").format(self._pluginPath.name, self._pluginOrigin)
def tr(self, str):
return QCoreApplication.translate("PluginMessage", str)
def tr(self, value: str):
return QCoreApplication.translate("PluginMessage", value)
def pluginPath(self):
return self._pluginPath
messageTypes = []
messageTypes: list[tuple[re.Pattern[str], Callable[[re.Match[str], mobase.IOrganizer], PluginMessage]]] = []
@staticmethod
def registerMessageType(messageType):
def registerMessageType(
messageType: tuple[
re.Pattern[str], Callable[[re.Match[str], mobase.IOrganizer], PluginMessage]
],
):
PluginMessage.messageTypes.append(messageType)
@staticmethod
def PluginMessageFactory(line, organizer):
def PluginMessageFactory(line: str, organizer: mobase.IOrganizer):
for messageType in PluginMessage.messageTypes:
match = messageType[0].fullmatch(line)
if match:
@@ -52,8 +55,8 @@ class PluginMessage():
class NormalPluginMessage(PluginMessage):
def __init__(self, match, organizer):
super(NormalPluginMessage, self).__init__(match.group("pluginPath"), organizer)
def __init__(self, match: re.Match[str], organizer: mobase.IOrganizer):
super().__init__(match.group("pluginPath"), organizer)
self.__infoVersion = int(match.group("infoVersion"), 16)
self.__name = match.group("name")
self.__version = int(match.group("version"), 16)
@@ -96,8 +99,8 @@ class NormalPluginMessage(PluginMessage):
# We aren't translating that.
return self.__loadStatus
def tr(self, str):
return QCoreApplication.translate("NormalPluginMessage", str)
def tr(self, value: str):
return QCoreApplication.translate("NormalPluginMessage", value)
PluginMessage.registerMessageType((re.compile(
@@ -106,8 +109,8 @@ PluginMessage.registerMessageType((re.compile(
class CouldntLoadPluginMessage(PluginMessage):
def __init__(self, match, organizer):
super(CouldntLoadPluginMessage, self).__init__(match.group("pluginPath"), organizer)
def __init__(self, match: re.Match[str], organizer: mobase.IOrganizer):
super().__init__(match.group("pluginPath"), organizer)
self.__lastError = int(match.group("lastError"))
self.__scriptExtenderDetails = match.group("seDetails")
if not self.__scriptExtenderDetails or self.__scriptExtenderDetails.isspace():
@@ -126,8 +129,8 @@ class CouldntLoadPluginMessage(PluginMessage):
return message.format(self._pluginPath.name, self.__lastError, self._pluginOrigin, self.__scriptExtenderDetails)
def tr(self, str):
return QCoreApplication.translate("CouldntLoadPluginMessage", str)
def tr(self, value: str):
return QCoreApplication.translate("CouldntLoadPluginMessage", value)
PluginMessage.registerMessageType((re.compile(
@@ -136,8 +139,8 @@ PluginMessage.registerMessageType((re.compile(
class NotAPluginMessage(PluginMessage):
def __init__(self, match, organizer):
super(NotAPluginMessage, self).__init__(match.group("pluginPath"), organizer)
def __init__(self, match: re.Match[str], organizer: mobase.IOrganizer):
super().__init__(match.group("pluginPath"), organizer)
def successful(self):
return not self.valid()
@@ -146,8 +149,8 @@ class NotAPluginMessage(PluginMessage):
return self.tr("{0} ({1}) does not appear to be a script extender plugin.").format(self._pluginPath.name,
self._pluginOrigin)
def tr(self, str):
return QCoreApplication.translate("NotAPluginMessage", str)
def tr(self, value: str):
return QCoreApplication.translate("NotAPluginMessage", value)
PluginMessage.registerMessageType((re.compile(
@@ -161,7 +164,11 @@ class LogLocation(Enum):
class ScriptExtenderPluginChecker(mobase.IPluginDiagnose):
GameType = namedtuple(("GameType"), ("base", "gameSuffix", "editorSuffix"))
class GameType(NamedTuple):
base: LogLocation
gameSuffix: Path | None
editorSuffix: Path | None
supportedGames = {
"Skyrim": GameType(LogLocation.DOCS, Path("SKSE") / "skse.log", Path("SKSE") / "skse_editor.log"),
"Skyrim Special Edition": GameType(LogLocation.DOCS, Path("SKSE") / "skse64.log", None),
@@ -175,11 +182,12 @@ class ScriptExtenderPluginChecker(mobase.IPluginDiagnose):
"Fallout 3": GameType(LogLocation.INSTALL, Path("fose.log"), Path("fose_editor.log"))
}
__organizer: mobase.IOrganizer
def __init__(self):
super(ScriptExtenderPluginChecker, self).__init__()
self.__organizer = None
def init(self, organizer):
def init(self, organizer: mobase.IOrganizer):
self.__organizer = organizer
organizer.onFinishedRun(lambda a, b: self._invalidate())
@@ -201,24 +209,24 @@ class ScriptExtenderPluginChecker(mobase.IPluginDiagnose):
def version(self):
return mobase.VersionInfo(1, 2, 0, 0)
def requirements(self):
def requirements(self) -> list[mobase.IPluginRequirement]:
return [
mobase.PluginRequirementFactory.gameDependency(self.supportedGames)
mobase.PluginRequirementFactory.gameDependency(list(self.supportedGames))
]
def settings(self):
def settings(self) -> list[mobase.PluginSetting]:
return []
def activeProblems(self):
def activeProblems(self) -> list[int]:
if self.__scanLog():
return [0]
else:
return []
def shortDescription(self, key):
def shortDescription(self, key: int):
return self.tr("Script extender log reports incompatible plugins.")
def fullDescription(self, key):
def fullDescription(self, key: int):
pluginList = self.__listBadPluginMessagess()
pluginListString = "\n" + ("\n".join(pluginList))
return self.tr("You have one or more script extender plugins which failed to load!\n\n "
@@ -229,19 +237,19 @@ class ScriptExtenderPluginChecker(mobase.IPluginDiagnose):
"To refresh the script extender logs, you will need to run the game and/or editor again!\n\n"
"The failed plugins are:{0}").format(pluginListString)
def hasGuidedFix(self, key):
def hasGuidedFix(self, key: int):
return False
def startGuidedFix(self, key):
def startGuidedFix(self, key: int):
pass
def tr(self, str):
return QCoreApplication.translate("ScriptExtenderPluginChecker", str)
def tr(self, value: str):
return QCoreApplication.translate("ScriptExtenderPluginChecker", value)
def __scanLog(self):
return len(self.__listBadPluginMessagess()) > 0
def __listBadPluginMessagess(self):
def __listBadPluginMessagess(self) -> list[str]:
base, gameSuffix, editorSuffix = self.supportedGames[self.__organizer.managedGame().gameName()]
if base == LogLocation.DOCS:
@@ -249,9 +257,8 @@ class ScriptExtenderPluginChecker(mobase.IPluginDiagnose):
elif base == LogLocation.INSTALL:
base = Path(self.__organizer.managedGame().gameDirectory().absolutePath())
messageList = []
editorMessageList = []
gameMessageList = []
editorMessageList: list[PluginMessage] = []
gameMessageList: list[PluginMessage] = []
if gameSuffix is not None:
gameLogPath = base / gameSuffix
@@ -281,6 +288,8 @@ class ScriptExtenderPluginChecker(mobase.IPluginDiagnose):
# There's almost certainly just no log yet
pass
messageList: list[str] = []
# Search each list for plugins that are not successful in either list
for gameMessage in gameMessageList:
if not gameMessage.successful():
+22 -22
View File
@@ -4,17 +4,17 @@
<context>
<name>CouldntLoadPluginMessage</name>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="121" />
<location filename="ScriptExtenderPluginChecker.py" line="124" />
<source>Couldn't load {0} ({2}). A dependency DLL could not be found (code {1}). {3}</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="123" />
<location filename="ScriptExtenderPluginChecker.py" line="126" />
<source>Couldn't load {0} ({2}). A DLL is invalid (code {1}).</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="125" />
<location filename="ScriptExtenderPluginChecker.py" line="128" />
<source>Couldn't load {0} ({2}). The last error code was {1}.</source>
<translation type="unfinished" />
</message>
@@ -22,67 +22,67 @@
<context>
<name>NormalPluginMessage</name>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="66" />
<location filename="ScriptExtenderPluginChecker.py" line="69" />
<source>{0} version {1} ({2}, {4}) {3}.</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="72" />
<location filename="ScriptExtenderPluginChecker.py" line="75" />
<source>loaded correctly</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="74" />
<location filename="ScriptExtenderPluginChecker.py" line="77" />
<source>disabled, address library needs to be updated</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="75" />
<location filename="ScriptExtenderPluginChecker.py" line="78" />
<source>disabled, fatal error occurred while loading plugin</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="77" />
<location filename="ScriptExtenderPluginChecker.py" line="80" />
<source>disabled, bad version data</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="78" />
<location filename="ScriptExtenderPluginChecker.py" line="81" />
<source>disabled, no name specified</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="79" />
<location filename="ScriptExtenderPluginChecker.py" line="82" />
<source>disabled, unsupported version independence method</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="81" />
<location filename="ScriptExtenderPluginChecker.py" line="84" />
<source>disabled, incompatible with current runtime version</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="83" />
<location filename="ScriptExtenderPluginChecker.py" line="86" />
<source>disabled, requires newer script extender</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="85" />
<location filename="ScriptExtenderPluginChecker.py" line="88" />
<source>reported as incompatible during query</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="86" />
<location filename="ScriptExtenderPluginChecker.py" line="89" />
<source>reported as incompatible during load</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="87" />
<location filename="ScriptExtenderPluginChecker.py" line="90" />
<source>disabled, fatal error occurred while checking plugin compatibility</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="89" />
<location filename="ScriptExtenderPluginChecker.py" line="92" />
<source>disabled, fatal error occurred while querying plugin</source>
<translation type="unfinished" />
</message>
@@ -90,7 +90,7 @@
<context>
<name>NotAPluginMessage</name>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="146" />
<location filename="ScriptExtenderPluginChecker.py" line="149" />
<source>{0} ({1}) does not appear to be a script extender plugin.</source>
<translation type="unfinished" />
</message>
@@ -98,7 +98,7 @@
<context>
<name>PluginMessage</name>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="31" />
<location filename="ScriptExtenderPluginChecker.py" line="30" />
<source>{0} ({1}) existed.</source>
<translation type="unfinished" />
</message>
@@ -106,22 +106,22 @@
<context>
<name>ScriptExtenderPluginChecker</name>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="193" />
<location filename="ScriptExtenderPluginChecker.py" line="201" />
<source>Script Extender Plugin Load Checker</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="199" />
<location filename="ScriptExtenderPluginChecker.py" line="207" />
<source>Checks script extender log to see if any plugins failed to load.</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="219" />
<location filename="ScriptExtenderPluginChecker.py" line="227" />
<source>Script extender log reports incompatible plugins.</source>
<translation type="unfinished" />
</message>
<message>
<location filename="ScriptExtenderPluginChecker.py" line="224" />
<location filename="ScriptExtenderPluginChecker.py" line="232" />
<source>You have one or more script extender plugins which failed to load!
If you want this notification to go away, here are some steps you can take:
+15
View File
@@ -0,0 +1,15 @@
{
"features": {
"standalone": {
"description": "Build Standalone.",
"dependencies": ["mo2-cmake"]
}
},
"vcpkg-configuration": {
"default-registry": {
"kind": "git",
"repository": "https://github.com/ModOrganizer2/vcpkg-registry",
"baseline": "27d8adbfe9e4ce88a875be3a45fadab69869eb60"
}
}
}