mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
Merge pull request #110 from ModOrganizer2/dev/clean-formatting
Formatting (black, isort, clang, line-ending).
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
1bffcfa8bfba93a9505692b11fdd3f0903983542
|
||||
7108d59267b0fe4e9442f9bb146ea5d70e7704a8
|
||||
@@ -0,0 +1,8 @@
|
||||
# Set the default behavior, in case people don't have core.autocrlf set.
|
||||
* text=auto
|
||||
|
||||
# Explicitly declare text files you want to always be normalized and converted
|
||||
# to native line endings on checkout.
|
||||
*.cpp text eol=crlf
|
||||
*.h text eol=crlf
|
||||
*.py text eol=crlf
|
||||
@@ -1,9 +1,14 @@
|
||||
name: Build Plugin Python
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: master
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
env:
|
||||
MO_BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2022
|
||||
@@ -23,7 +28,7 @@ jobs:
|
||||
key: ${{ runner.OS }}-mob-cache-${{ hashFiles('mob/.git/refs/heads/master') }}
|
||||
restore-keys: |
|
||||
${{ runner.OS }}-mob-cache-
|
||||
- if: ${{ steps.cache-mob.outputs.cache-hit != 'true' }}
|
||||
- if: steps.cache-mob.outputs.cache-hit != 'true'
|
||||
name: Build mob
|
||||
run: .\mob\bootstrap.ps1
|
||||
- name: Install Qt
|
||||
@@ -44,7 +49,7 @@ jobs:
|
||||
key: ${{ runner.OS }}-mo2-dependencies-${{ hashFiles('mob/.git/refs/heads/master') }}
|
||||
restore-keys: |
|
||||
${{ runner.OS }}-mo2-dependencies-
|
||||
- if: ${{ steps.cache-dependencies.outputs.cache-hit != 'true' }}
|
||||
- if: steps.cache-dependencies.outputs.cache-hit != 'true'
|
||||
name: Build dependencies with mob
|
||||
run: .\mob\mob.exe
|
||||
-l 4 -d .
|
||||
@@ -58,7 +63,9 @@ jobs:
|
||||
mob.log
|
||||
# TODO: cache this?
|
||||
- name: Build cmake_common and uibase
|
||||
run: .\mob\mob.exe -l 4 -d . build
|
||||
run: .\mob\mob.exe -l 4 -d .
|
||||
-s task/mo_fallback=master -s task/mo_branch=${{ env.MO_BRANCH }}
|
||||
build
|
||||
--ignore-uncommitted-changes
|
||||
--redownload --reextract --reconfigure --rebuild
|
||||
cmake_common uibase
|
||||
|
||||
@@ -10,3 +10,8 @@ jobs:
|
||||
with:
|
||||
clang-format-version: "15"
|
||||
check-path: "."
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- uses: isort/isort-action@master
|
||||
- uses: psf/black@stable
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
[flake8]
|
||||
# Use black line length:
|
||||
max-line-length = 88
|
||||
extend-ignore =
|
||||
# See https://github.com/PyCQA/pycodestyle/issues/373
|
||||
E203, E266
|
||||
|
||||
[isort]
|
||||
profile = black
|
||||
multi_line_output = 3
|
||||
known_mobase = mobase
|
||||
sections=FUTURE,STDLIB,THIRDPARTY,MOBASE,FIRSTPARTY,LOCALFOLDER
|
||||
+291
-291
File diff suppressed because it is too large
Load Diff
+76
-76
@@ -1,76 +1,76 @@
|
||||
/*
|
||||
Copyright (C) 2022 Sebastian Herbord & MO2 Team. All rights reserved.
|
||||
|
||||
This file is part of python proxy plugin for MO
|
||||
|
||||
python proxy plugin is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Python proxy plugin is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with python proxy plugin. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PROXYPYTHON_H
|
||||
#define PROXYPYTHON_H
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
#include <iplugindiagnose.h>
|
||||
#include <ipluginproxy.h>
|
||||
|
||||
#include <pythonrunner.h>
|
||||
|
||||
class ProxyPython : public QObject,
|
||||
public MOBase::IPluginProxy,
|
||||
public MOBase::IPluginDiagnose {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginProxy MOBase::IPluginDiagnose)
|
||||
Q_PLUGIN_METADATA(IID "org.mo2.ProxyPython")
|
||||
|
||||
public:
|
||||
ProxyPython();
|
||||
|
||||
virtual bool init(MOBase::IOrganizer* moInfo);
|
||||
virtual QString name() const override;
|
||||
virtual QString localizedName() const override;
|
||||
virtual QString author() const override;
|
||||
virtual QString description() const override;
|
||||
virtual MOBase::VersionInfo version() const override;
|
||||
virtual QList<MOBase::PluginSetting> settings() const override;
|
||||
|
||||
QStringList pluginList(const QDir& pluginPath) const override;
|
||||
QList<QObject*> load(const QString& identifier) override;
|
||||
void unload(const QString& identifier) override;
|
||||
|
||||
public: // IPluginDiagnose
|
||||
virtual std::vector<unsigned int> activeProblems() const override;
|
||||
virtual QString shortDescription(unsigned int key) const override;
|
||||
virtual QString fullDescription(unsigned int key) const override;
|
||||
virtual bool hasGuidedFix(unsigned int key) const override;
|
||||
virtual void startGuidedFix(unsigned int key) const override;
|
||||
|
||||
private:
|
||||
MOBase::IOrganizer* m_MOInfo;
|
||||
HMODULE m_RunnerLib;
|
||||
std::unique_ptr<mo2::python::IPythonRunner> m_Runner;
|
||||
|
||||
enum class FailureType : unsigned int {
|
||||
NONE = 0,
|
||||
SEMICOLON = 1,
|
||||
DLL_NOT_FOUND = 2,
|
||||
INVALID_DLL = 3,
|
||||
INITIALIZATION = 4
|
||||
};
|
||||
|
||||
FailureType m_LoadFailure;
|
||||
};
|
||||
|
||||
#endif // PROXYPYTHON_H
|
||||
/*
|
||||
Copyright (C) 2022 Sebastian Herbord & MO2 Team. All rights reserved.
|
||||
|
||||
This file is part of python proxy plugin for MO
|
||||
|
||||
python proxy plugin is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Python proxy plugin is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with python proxy plugin. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PROXYPYTHON_H
|
||||
#define PROXYPYTHON_H
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
#include <iplugindiagnose.h>
|
||||
#include <ipluginproxy.h>
|
||||
|
||||
#include <pythonrunner.h>
|
||||
|
||||
class ProxyPython : public QObject,
|
||||
public MOBase::IPluginProxy,
|
||||
public MOBase::IPluginDiagnose {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginProxy MOBase::IPluginDiagnose)
|
||||
Q_PLUGIN_METADATA(IID "org.mo2.ProxyPython")
|
||||
|
||||
public:
|
||||
ProxyPython();
|
||||
|
||||
virtual bool init(MOBase::IOrganizer* moInfo);
|
||||
virtual QString name() const override;
|
||||
virtual QString localizedName() const override;
|
||||
virtual QString author() const override;
|
||||
virtual QString description() const override;
|
||||
virtual MOBase::VersionInfo version() const override;
|
||||
virtual QList<MOBase::PluginSetting> settings() const override;
|
||||
|
||||
QStringList pluginList(const QDir& pluginPath) const override;
|
||||
QList<QObject*> load(const QString& identifier) override;
|
||||
void unload(const QString& identifier) override;
|
||||
|
||||
public: // IPluginDiagnose
|
||||
virtual std::vector<unsigned int> activeProblems() const override;
|
||||
virtual QString shortDescription(unsigned int key) const override;
|
||||
virtual QString fullDescription(unsigned int key) const override;
|
||||
virtual bool hasGuidedFix(unsigned int key) const override;
|
||||
virtual void startGuidedFix(unsigned int key) const override;
|
||||
|
||||
private:
|
||||
MOBase::IOrganizer* m_MOInfo;
|
||||
HMODULE m_RunnerLib;
|
||||
std::unique_ptr<mo2::python::IPythonRunner> m_Runner;
|
||||
|
||||
enum class FailureType : unsigned int {
|
||||
NONE = 0,
|
||||
SEMICOLON = 1,
|
||||
DLL_NOT_FOUND = 2,
|
||||
INVALID_DLL = 3,
|
||||
INITIALIZATION = 4
|
||||
};
|
||||
|
||||
FailureType m_LoadFailure;
|
||||
};
|
||||
|
||||
#endif // PROXYPYTHON_H
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifndef RESOURCE_H
|
||||
#define RESOURCE_H
|
||||
|
||||
#define IDR_LOADER_DLL 100
|
||||
|
||||
#endif // RESOURCE_H
|
||||
#ifndef RESOURCE_H
|
||||
#define RESOURCE_H
|
||||
|
||||
#define IDR_LOADER_DLL 100
|
||||
|
||||
#endif // RESOURCE_H
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import mobase
|
||||
import pytest
|
||||
|
||||
import mobase
|
||||
|
||||
m = pytest.importorskip("mobase_tests.argument_wrapper")
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import mobase
|
||||
import pytest
|
||||
|
||||
import mobase
|
||||
|
||||
m = pytest.importorskip("mobase_tests.filetree")
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import mobase
|
||||
import pytest
|
||||
|
||||
import mobase
|
||||
|
||||
m = pytest.importorskip("mobase_tests.functional")
|
||||
|
||||
|
||||
def test_guessed_string():
|
||||
|
||||
# available functions:
|
||||
# - fn_0_arg, fn_1_arg, fn_2_arg
|
||||
# - fn_0_or_1_arg, fn_1_or_2_or_3_arg
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import mobase
|
||||
import pytest
|
||||
|
||||
import mobase
|
||||
|
||||
m = pytest.importorskip("mobase_tests.guessed_string")
|
||||
|
||||
|
||||
def test_guessed_string():
|
||||
|
||||
# empty string
|
||||
gs = mobase.GuessedString()
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import mobase
|
||||
import pytest
|
||||
from PyQt6.QtCore import QDir, QFileInfo
|
||||
|
||||
import mobase
|
||||
|
||||
|
||||
def test_filepath_wrappers():
|
||||
|
||||
# TBC that this works everywhere
|
||||
version = ".".join(map(str, sys.version_info[:3]))
|
||||
|
||||
|
||||
@@ -50,7 +50,6 @@ def test_qdatetime():
|
||||
|
||||
|
||||
def test_qvariant():
|
||||
|
||||
# Python -> C++
|
||||
|
||||
assert m.qvariant_from_none(None) == (True, False)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
import mobase
|
||||
from PyQt6.QtWidgets import QWidget
|
||||
|
||||
import mobase
|
||||
|
||||
|
||||
class DummyModDataChecker(mobase.ModDataChecker):
|
||||
def dataLooksValid(
|
||||
@@ -26,7 +27,6 @@ class DummySaveGameInfo(mobase.SaveGameInfo):
|
||||
# from the C++ side
|
||||
#
|
||||
class DummyGame(mobase.IPluginGame):
|
||||
|
||||
_features: dict[type, object]
|
||||
|
||||
def __init__(self):
|
||||
|
||||
Reference in New Issue
Block a user