Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose INVALID_HANDLE_VALUE as mobase.INVALID_HANDLE_VALUE. #131

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run clang-format
uses: jidicula/clang-format-action@v4.11.0
- name: Check format
uses: ModOrganizer2/check-formatting-action@master
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
python-version: "3.12"
- uses: abatilo/actions-poetry@v2
- name: Check format Python tests
run: |
poetry install --no-root
poetry run poe lint
254 changes: 254 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[tool.poetry]
name = "modorganizer-plugin_python"
version = "3.0.0"
description = ""
authors = ["Mikaël Capelle <capelle.mikael@gmail.com>"]

[tool.poetry.dependencies]
python = "^3.12"

[tool.poetry.group.dev.dependencies]
pyright = "^1.1.369"
ruff = "^0.2.1"
poethepoet = "^0.23.0"
mobase-stubs = { version = "^2.5.1a0", allow-prereleases = true }
pyqt6 = "^6.7.0"
pytest = "^8.2.2"
pybind11-stubgen = "^2.5.1"

[tool.poe.tasks]
format-imports = "ruff check --select I tests typings --fix"
format-ruff = "ruff format tests typings"
format.sequence = ["format-imports", "format-ruff"]
lint-ruff = "ruff check tests typings"
lint-ruff-format = "ruff format --check tests typings"
lint.sequence = ["lint-ruff", "lint-ruff-format"]
lint.ignore_fail = "return_non_zero"

[tool.ruff]
target-version = "py312"

[tool.ruff.lint]
extend-select = ["B", "Q", "I"]

[tool.ruff.lint.isort.sections]
mobase = ["mobase"]
mobase_tests = ["mobase_tests"]

[tool.ruff.lint.isort]
section-order = [
"future",
"standard-library",
"third-party",
"first-party",
"mobase",
"mobase_tests",
"local-folder",
]

[tool.pyright]
typeCheckingMode = "strict"
reportMissingTypeStubs = true
reportMissingModuleSource = false
pythonPlatform = "Windows"
12 changes: 0 additions & 12 deletions setup.cfg

This file was deleted.

3 changes: 3 additions & 0 deletions src/mobase/wrappers/basic_classes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,9 @@ namespace mo2::python {

void add_iorganizer_classes(py::module_ m)
{
// define INVALID_HANDLE_VALUE for startApplication, etc.
m.attr("INVALID_HANDLE_VALUE") = py::int_((std::uintptr_t)INVALID_HANDLE_VALUE);

py::class_<IOrganizer::FileInfo>(m, "FileInfo")
.def(py::init<>())
.def_readwrite("filePath", &IOrganizer::FileInfo::filePath)
Expand Down
1 change: 0 additions & 1 deletion tests/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ add_test(NAME pytest
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/pylibs/bin/pytest.exe ${CMAKE_CURRENT_SOURCE_DIR} -s
)

set(extra_paths "${UIBASE_PATH}\\;${MO2_INSTALL_PATH}/bin/dlls")
set_tests_properties(pytest
PROPERTIES
DEPENDS python-tests
Expand Down
7 changes: 3 additions & 4 deletions tests/python/conftest.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# -*- encoding: utf-8 -*-

import os
import sys
from pathlib import Path
from typing import cast


def pytest_configure():
global app

os.add_dll_directory(Path(os.getenv("QT_ROOT")).joinpath("bin"))
os.add_dll_directory(Path(os.getenv("UIBASE_PATH")))
os.add_dll_directory(str(Path(cast(str, os.getenv("QT_ROOT"))).joinpath("bin")))
os.add_dll_directory(str(os.getenv("UIBASE_PATH")))

from PyQt6.QtWidgets import QApplication

Expand Down
Loading
Loading