26 Commits
Author SHA1 Message Date
Oliver Hamlet d356ac2445 Set version number to 4.0.2 2019-03-25 09:47:46 +00:00
Oliver Hamlet fe4c3ab6b5 Update libloot to v0.14.5 2019-03-25 09:47:03 +00:00
Oliver Hamlet b17b531073 Fix get_plugin_cleanliness never returning dirty 2019-03-25 09:01:29 +00:00
Oliver Hamlet 06a6d9ceb6 Use CTest to run Python tests
Avoid having to copy the test script by modifying PYTHONPATH at runtime,
and move the test script into the test directory.
2019-03-25 08:38:34 +00:00
Oliver Hamlet a35abab104 Add a test masterlist
It'll be extended with more test metadata in future.
2019-03-25 08:20:03 +00:00
Oliver Hamlet 646a8d02e0 Add .vscode/ to .gitignore 2019-03-25 08:06:31 +00:00
Oliver Hamlet cab63886d3 Set version number to 4.0.1 2019-01-27 14:53:14 +00:00
Oliver Hamlet 8a61701855 Update libloot to v0.14.3 2019-01-27 14:52:03 +00:00
Oliver Hamlet 8c75e83374 Update a few references to MSVC 2015 redist to be 2017 2019-01-27 14:50:34 +00:00
Oliver Hamlet 5450709ebe Update docs 2019-01-12 17:16:43 +00:00
Oliver Hamlet 3a9ff95de2 Update wrapper version to 4.0.0 2019-01-12 17:14:12 +00:00
Oliver Hamlet 1298fce6fd Update libloot to v0.14.1 2019-01-12 15:55:22 +00:00
Oliver Hamlet 21242f359d Update readme 2018-12-13 17:46:21 +00:00
Oliver Hamlet 6579eb5178 Build for Python 2.7 and 3.7 on AppVeyor 2018-12-13 17:20:57 +00:00
Oliver Hamlet 61a74b6984 Build 32-bit and 64-bit binaries on AppVeyor 2018-12-13 08:08:58 +00:00
Oliver Hamlet 66f84d4848 Support 64-bit builds 2018-12-13 08:05:01 +00:00
Oliver Hamlet 5f5c0e3949 Update pybind11 to fix AppVeyor build
Utumno experienced issues with Python modules built with more recent
versions of pybind11, which is why I tried to avoid this, but it looks
like it's necessary.
2018-12-12 19:59:14 +00:00
Oliver Hamlet ab926c8755 Use masterlist with fixed syntax
The older masterlist had parentheses between not and a function, which
has never been valid, but which only caused an error starting with
v0.14.0.
2018-12-12 19:57:34 +00:00
Oliver Hamlet 35475b292f Update to libloot v0.14.0
libloot is the renamed LOOT API. This adds a requirement on C++17,
and so MSVC 2017 on Windows.

pybind11 doesn't provide handling for std::filesystem::path, so wrapper
functions are used to perform the necessary one-way conversion without
having to expose the complexity on the Python side.
2018-12-12 19:33:21 +00:00
Oliver Hamlet 51e2e4e4fa Remove Travis badge
Travis hasn't been used for a while now.
2018-11-07 17:26:39 +00:00
Oliver Hamlet c17437a579 Fix AppVeyor CI link
Also update a GitHub URL, replacing WrinklyNinja with Ortham.
2018-11-07 16:58:07 +00:00
Oliver Hamlet 49204621c5 Fix typo in bintray delete script call 2018-08-12 22:26:55 +01:00
Oliver Hamlet 3098ffa692 Update Bintray delete script to fix deleting old builds 2018-08-12 21:47:54 +01:00
Oliver Hamlet 392a090823 Re-encrypt Bintray and GitHub auth tokens
Using the values encrypted by AppVeyor when I'm logged in as myself for
the LOOT account.
2018-08-12 21:47:02 +01:00
Oliver Hamlet e98b43a4b1 Remove old builds from LOOT's Bintray org 2018-08-08 21:39:24 +01:00
Oliver Hamlet a957ece62b Upload artifacts to repo in LOOT's Bintray org 2018-08-06 21:07:20 +01:00
12 changed files with 238 additions and 103 deletions
+2
View File
@@ -50,3 +50,5 @@ $RECYCLE.BIN/
# Windows shortcuts # Windows shortcuts
*.lnk *.lnk
.vscode/
+30 -40
View File
@@ -6,6 +6,10 @@ include(ExternalProject)
set(EXTERNAL_PROJECTS_PATH "${CMAKE_BINARY_DIR}/external/src") set(EXTERNAL_PROJECTS_PATH "${CMAKE_BINARY_DIR}/external/src")
make_directory(${EXTERNAL_PROJECTS_PATH}) make_directory(${EXTERNAL_PROJECTS_PATH})
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
############################## ##############################
# Get Build Revision # Get Build Revision
############################## ##############################
@@ -30,7 +34,7 @@ configure_file("${CMAKE_SOURCE_DIR}/src/wrapper_version.cpp.in" "${CMAKE_BINARY_
# pybind11 # pybind11
####################################### #######################################
set(PYBIND11_VERSION "2.1.1") set(PYBIND11_VERSION "2.2.4")
set(PYBIND11_URL "https://github.com/pybind/pybind11/archive/v${PYBIND11_VERSION}.tar.gz") set(PYBIND11_URL "https://github.com/pybind/pybind11/archive/v${PYBIND11_VERSION}.tar.gz")
set(PYBIND11_DOWNLOAD_PATH "${EXTERNAL_PROJECTS_PATH}/pybind11-${PYBIND11_VERSION}.tar.gz") set(PYBIND11_DOWNLOAD_PATH "${EXTERNAL_PROJECTS_PATH}/pybind11-${PYBIND11_VERSION}.tar.gz")
set(PYBIND11_EXTRACTED_PATH "${EXTERNAL_PROJECTS_PATH}/pybind11-${PYBIND11_VERSION}") set(PYBIND11_EXTRACTED_PATH "${EXTERNAL_PROJECTS_PATH}/pybind11-${PYBIND11_VERSION}")
@@ -50,36 +54,29 @@ add_subdirectory(${PYBIND11_EXTRACTED_PATH})
####################################### #######################################
if (CMAKE_SYSTEM_NAME MATCHES "Windows") if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(LOOT_API_URL "https://github.com/loot/loot-api/releases/download/0.13.2/loot_api-0.13.2-0-g5956e60_dev-win32.7z") if (NOT "${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)")
set(LIBLOOT_URL "https://github.com/loot/libloot/releases/download/0.14.5/libloot-0.14.5-0-g68ecc02_dev-win32.7z")
else()
set(LIBLOOT_URL "https://github.com/loot/libloot/releases/download/0.14.5/libloot-0.14.5-0-g68ecc02_dev-win64.7z")
endif()
else() else()
set(LOOT_API_URL "https://github.com/loot/loot-api/releases/download/0.13.2/loot-api.tar.xz") set(LIBLOOT_URL "https://github.com/loot/libloot/releases/download/0.14.5/libloot.tar.xz")
endif() endif()
ExternalProject_Add(loot-api-c++ ExternalProject_Add(libloot
PREFIX "external" PREFIX "external"
URL ${LOOT_API_URL} URL ${LIBLOOT_URL}
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""
INSTALL_COMMAND "") INSTALL_COMMAND "")
ExternalProject_Get_Property(loot-api-c++ SOURCE_DIR) ExternalProject_Get_Property(libloot SOURCE_DIR)
set(LOOT_API_EXTRACTED_PATH ${SOURCE_DIR}) set(LIBLOOT_EXTRACTED_PATH ${SOURCE_DIR})
include_directories("${CMAKE_SOURCE_DIR}/src" include_directories("${CMAKE_SOURCE_DIR}/src"
"${LOOT_API_EXTRACTED_PATH}/include") "${LIBLOOT_EXTRACTED_PATH}/include")
link_directories(${LOOT_API_EXTRACTED_PATH}) link_directories(${LIBLOOT_EXTRACTED_PATH})
set(LOOT_API_STATIC_LIBRARY "${CMAKE_STATIC_LIBRARY_PREFIX}loot_api${CMAKE_STATIC_LIBRARY_SUFFIX}") set(LIBLOOT_STATIC_LIBRARY "${CMAKE_STATIC_LIBRARY_PREFIX}loot${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(LOOT_API_SHARED_LIBRARY "${CMAKE_SHARED_LIBRARY_PREFIX}loot_api${CMAKE_SHARED_LIBRARY_SUFFIX}") set(LIBLOOT_SHARED_LIBRARY "${CMAKE_SHARED_LIBRARY_PREFIX}loot${CMAKE_SHARED_LIBRARY_SUFFIX}")
#######################################
# Test Masterlist
#######################################
ExternalProject_Add(test-masterlist
PREFIX "external"
URL "https://github.com/loot/oblivion/archive/09286601739c11a3a3e4552c6ddbdcaeffd1a8d3.zip"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND "")
####################################### #######################################
# Python Module # Python Module
@@ -89,12 +86,12 @@ pybind11_add_module(loot_api "${CMAKE_SOURCE_DIR}/src/main.cpp"
"${CMAKE_SOURCE_DIR}/src/convenience.cpp" "${CMAKE_SOURCE_DIR}/src/convenience.cpp"
"${CMAKE_BINARY_DIR}/generated/wrapper_version.cpp") "${CMAKE_BINARY_DIR}/generated/wrapper_version.cpp")
add_dependencies(loot_api loot-api-c++ test-masterlist) add_dependencies(loot_api libloot)
if (CMAKE_SYSTEM_NAME MATCHES "Windows") if (CMAKE_SYSTEM_NAME MATCHES "Windows")
target_link_libraries(loot_api PRIVATE ${LOOT_API_STATIC_LIBRARY}) target_link_libraries(loot_api PRIVATE ${LIBLOOT_STATIC_LIBRARY})
else() else()
target_link_libraries(loot_api PRIVATE ${LOOT_API_SHARED_LIBRARY}) target_link_libraries(loot_api PRIVATE ${LIBLOOT_SHARED_LIBRARY})
endif() endif()
######################################## ########################################
@@ -106,21 +103,14 @@ find_package(PythonInterp REQUIRED)
# Copy the API binary to the build directory. # Copy the API binary to the build directory.
add_custom_command(TARGET loot_api POST_BUILD add_custom_command(TARGET loot_api POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${LOOT_API_EXTRACTED_PATH}/${LOOT_API_SHARED_LIBRARY}" "${LIBLOOT_EXTRACTED_PATH}/${LIBLOOT_SHARED_LIBRARY}"
"$<TARGET_FILE_DIR:loot_api>/${LOOT_API_SHARED_LIBRARY}") "$<TARGET_FILE_DIR:loot_api>/${LIBLOOT_SHARED_LIBRARY}")
# Copy the test masterlist to the build directory. enable_testing()
ExternalProject_Get_Property(test-masterlist SOURCE_DIR)
add_custom_command(TARGET loot_api POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${SOURCE_DIR}/masterlist.yaml"
"$<TARGET_FILE_DIR:loot_api>/masterlist.yaml")
# Also copy the test Python script to the build directory. add_test(NAME python
add_custom_command(TARGET loot_api POST_BUILD WORKING_DIRECTORY $<TARGET_FILE_DIR:loot_api>
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND "${PYTHON_EXECUTABLE}" ${CMAKE_SOURCE_DIR}/test/test.py)
"${CMAKE_SOURCE_DIR}/src/test.py"
"$<TARGET_FILE_DIR:loot_api>/test.py")
######################################## ########################################
# Install # Install
@@ -130,7 +120,7 @@ install(TARGETS loot_api
DESTINATION "." DESTINATION "."
CONFIGURATIONS Release RelWithDebInfo) CONFIGURATIONS Release RelWithDebInfo)
install(FILES "${LOOT_API_EXTRACTED_PATH}/${LOOT_API_SHARED_LIBRARY}" install(FILES "${LIBLOOT_EXTRACTED_PATH}/${LIBLOOT_SHARED_LIBRARY}"
"${CMAKE_SOURCE_DIR}/docs/README.md" "${CMAKE_SOURCE_DIR}/docs/README.md"
DESTINATION "." DESTINATION "."
CONFIGURATIONS Release RelWithDebInfo) CONFIGURATIONS Release RelWithDebInfo)
@@ -171,7 +161,7 @@ else()
set(CPACK_GENERATOR "TXZ") set(CPACK_GENERATOR "TXZ")
endif() endif()
set(CPACK_PACKAGE_VERSION ${GIT_DESCRIBE_STRING}) set(CPACK_PACKAGE_VERSION "${GIT_DESCRIBE_STRING}-python$ENV{PYTHON_VERSION}")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/package") set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}/package")
include(CPack) include(CPack)
+6 -7
View File
@@ -1,21 +1,20 @@
LOOT API Python Module LOOT API Python Module
======================= =======================
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/loot/loot-api-python?branch=master&svg=true)](https://ci.appveyor.com/project/WrinklyNinja/loot-api-python) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/k2ugge3po7254o1o/branch/master?svg=true)](https://ci.appveyor.com/project/LOOT/loot-api-python/branch/master)
[![Travis Build Status](https://travis-ci.org/loot/loot-api-python.svg?branch=master)](https://travis-ci.org/loot/loot-api-python)
[![Documentation Status](https://readthedocs.org/projects/loot-api-python/badge/)](http://loot-api-python.readthedocs.io/) [![Documentation Status](https://readthedocs.org/projects/loot-api-python/badge/)](http://loot-api-python.readthedocs.io/)
A Python module that wraps the LOOT API, generated by [pybind11](https://github.com/pybind/pybind11). Not everything in the API is exposed: coverage can be extended on request (or by pull request). A Python module that wraps libloot, generated by [pybind11](https://github.com/pybind/pybind11). Not everything in the API is exposed: coverage can be extended on request (or by pull request).
## Downloads ## Downloads
Snapshot builds are available on [Bintray](https://bintray.com/wrinklyninja/loot/loot-api-python). The snapshot build archives are named like so: Snapshot builds are available on [Bintray](https://bintray.com/loot/snapshots/loot-api-python). The snapshot build archives are named like so:
``` ```
loot_api_python-<short revision ID>-win32.7z loot_api_python-<short revision ID>-python<python version>-win<architecture>.7z
``` ```
For example `loot_api_python-94de368-win32.7z` was built using the revision with shortened commit ID `94de368`. For example `loot_api_python-94de368-python2.7-win32.7z` was built using the revision with shortened commit ID `94de368`.
## Documentation ## Documentation
@@ -23,6 +22,6 @@ The documentation can be found online at [Read The Docs](http://loot-api-python.
## Build Instructions ## Build Instructions
The module's build system uses [CMake](https://cmake.org/) and requires [Python](https://www.python.org) (tested with 2.7). Make sure they're installed, then run CMake, and build the generated solution file. The module's build system uses [CMake](https://cmake.org/) and requires [Python](https://www.python.org). Make sure they're installed, then run CMake, and build the generated solution file.
Only Windows support has been tested, though Linux builds should also be possible. Only Windows support has been tested, though Linux builds should also be possible.
+29 -12
View File
@@ -1,21 +1,37 @@
os: Visual Studio 2015 os: Visual Studio 2017
version: "{build}-{branch}" version: "{build}-{branch}"
configuration: RelWithDebInfo configuration: RelWithDebInfo
platform:
- Win32
- x64
environment: environment:
bintray_auth_token: bintray_auth_token:
secure: fBQJmUDK/EgEUWjjbo6bWcitczeFTJZT4OZ3ZZ4FoUT6soBsTWPQJnr8YEVMFhGP secure: PgsEA6TjHVf718zMnK7J/fT1hUAVNKBeWhpYgYaeCyeZk37VT4Ics6j7+B7ElLEr
github_auth_token:
secure: yDqT5l/e5MntbW99V6+MHlfFgNv+UIogFfeyUVqtFk5lFRB/dAraLLwKCLl6y+DH
matrix:
- PYTHON_VERSION: 2.7
- PYTHON_VERSION: 3.7
install: install:
- ps: (New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/WrinklyNinja/ci-scripts/1.1.0/delete_old_bintray_versions.py', "$env:APPVEYOR_BUILD_FOLDER\delete_old_bintray_versions.py") - ps: (New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/Ortham/ci-scripts/2.0.0/delete_old_bintray_versions.py', "$env:APPVEYOR_BUILD_FOLDER\delete_old_bintray_versions.py")
before_build: before_build:
- ps: $env:PYTHON_DIRECTORY_VERSION=$env:PYTHON_VERSION.Replace(".", "")
- cd %APPVEYOR_BUILD_FOLDER% - cd %APPVEYOR_BUILD_FOLDER%
- ps: mkdir build - ps: mkdir build
- cd build - cd build
- cmake .. -G "Visual Studio 14 2015" - ps: |
if ($env:PLATFORM -eq 'Win32') {
cmake .. -G "Visual Studio 15 2017" -DPYTHON_EXECUTABLE="C:\Python${env:PYTHON_DIRECTORY_VERSION}\python.exe"
} else {
cmake .. -G "Visual Studio 15 2017 Win64" -DPYTHON_EXECUTABLE="C:\Python${env:PYTHON_DIRECTORY_VERSION}-x64\python.exe"
}
build: build:
verbosity: minimal verbosity: minimal
@@ -23,7 +39,8 @@ build:
test_script: test_script:
- cd %APPVEYOR_BUILD_FOLDER%\build\%CONFIGURATION% - cd %APPVEYOR_BUILD_FOLDER%\build\%CONFIGURATION%
- python -m unittest test - ps: $env:ARCHITECTURE=$env:PLATFORM.Substring($env:PLATFORM.Length - 2)
- py -%PYTHON_VERSION%-%ARCHITECTURE% -m unittest test
after_test: after_test:
- cd %APPVEYOR_BUILD_FOLDER%\build - cd %APPVEYOR_BUILD_FOLDER%\build
@@ -33,16 +50,16 @@ after_test:
- ps: $env:GIT_DESCRIBE = ((git describe --tags --long --always) | Out-String) -replace "`n|`r", "" - ps: $env:GIT_DESCRIBE = ((git describe --tags --long --always) | Out-String) -replace "`n|`r", ""
artifacts: artifacts:
- path: build\package\loot_api_python-$(GIT_DESCRIBE)_$(APPVEYOR_REPO_BRANCH)-win32.7z - path: build\package\loot_api_python-$(GIT_DESCRIBE)_$(APPVEYOR_REPO_BRANCH)-python$(PYTHON_VERSION)-win$(ARCHITECTURE).7z
name: loot_api_python name: loot_api_python
deploy: deploy:
- provider: BinTray - provider: BinTray
username: wrinklyninja username: wrinklyninja
api_key: api_key:
secure: fBQJmUDK/EgEUWjjbo6bWcitczeFTJZT4OZ3ZZ4FoUT6soBsTWPQJnr8YEVMFhGP secure: PgsEA6TjHVf718zMnK7J/fT1hUAVNKBeWhpYgYaeCyeZk37VT4Ics6j7+B7ElLEr
subject: wrinklyninja subject: loot
repo: loot repo: snapshots
package: loot-api-python package: loot-api-python
version: $(GIT_DESCRIBE)_$(APPVEYOR_REPO_BRANCH) version: $(GIT_DESCRIBE)_$(APPVEYOR_REPO_BRANCH)
publish: true publish: true
@@ -52,13 +69,13 @@ deploy:
tag: $(APPVEYOR_REPO_TAG_NAME) tag: $(APPVEYOR_REPO_TAG_NAME)
release: LOOT API Python Module v$(APPVEYOR_REPO_TAG_NAME) release: LOOT API Python Module v$(APPVEYOR_REPO_TAG_NAME)
description: | description: |
Requires Windows 7 or later and the [MSVC 2015 x86 redistributable](https://download.microsoft.com/download/6/A/A/6AA4EDFF-645B-48C5-81CC-ED5963AEAD48/vc_redist.x86.exe), and [7-Zip](http://www.7-zip.org/) to extract the archive. Requires Windows 7 or later and the [MSVC 2017 x86 redistributable](https://download.visualstudio.microsoft.com/download/pr/749aa419-f9e4-4578-a417-a43786af205e/d59197078cc425377be301faba7dd87a/vc_redist.x86.exe), and [7-Zip](http://www.7-zip.org/) to extract the archive.
auth_token: auth_token:
secure: V1GojGQfrAiQtUWtNNXfm3samiH+1yNF5UYhkn8B8mbif20IGTGWNlBS9E4S0SUC secure: yDqT5l/e5MntbW99V6+MHlfFgNv+UIogFfeyUVqtFk5lFRB/dAraLLwKCLl6y+DH
artifact: loot_api_python artifact: loot_api_python
draft: false draft: false
on: on:
appveyor_repo_tag: true appveyor_repo_tag: true
on_success: on_success:
- ps: python "$env:APPVEYOR_BUILD_FOLDER\delete_old_bintray_versions.py" -o loot -g loot-api-python -u wrinklyninja -b loot -p loot-api-python -t $env:bintray_auth_token -n 30 - ps: python "$env:APPVEYOR_BUILD_FOLDER\delete_old_bintray_versions.py" -g loot/loot-api-python -b loot/snapshots/loot-api-python -u wrinklyninja -k $env:bintray_auth_token -t $env:github_auth_token -n 30
+1 -1
View File
@@ -3,7 +3,7 @@ LOOT API Python Wrapper
This archive contains a build of the LOOT API Python wrapper module and its corresponding 32-bit Windows build of the LOOT API. This archive contains a build of the LOOT API Python wrapper module and its corresponding 32-bit Windows build of the LOOT API.
The DLL requires the [MSVC 2015 x86 redistributable](https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe) The DLL requires the [MSVC 2017 x86 redistributable](https://download.visualstudio.microsoft.com/download/pr/749aa419-f9e4-4578-a417-a43786af205e/d59197078cc425377be301faba7dd87a/vc_redist.x86.exe)
to be installed. to be installed.
See the [online documentation](http://loot-api-python.readthedocs.org/) for more information. See the [online documentation](http://loot-api-python.readthedocs.org/) for more information.
+2 -2
View File
@@ -55,7 +55,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = u'LOOT API Python Module' project = u'LOOT API Python Module'
copyright = u'2016, WrinklyNinja' copyright = u'2019, WrinklyNinja'
author = u'WrinklyNinja' author = u'WrinklyNinja'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
@@ -346,5 +346,5 @@ texinfo_documents = [
# Example configuration for intersphinx: refer to the Python standard library. # Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = { intersphinx_mapping = {
'loot_api': ('http://loot.readthedocs.io/en/0.10.2/', None), 'loot_api': ('http://loot.readthedocs.io/en/0.14.5/', None),
} }
+3 -3
View File
@@ -10,13 +10,13 @@ Build archives contain two binaries:
* ``loot_api.pyd`` is the Python wrapper * ``loot_api.pyd`` is the Python wrapper
* ``loot_api.dll`` is the C++ API DLL that the Python wrapper was built against. * ``loot_api.dll`` is the C++ API DLL that the Python wrapper was built against.
The C++ DLL requires the `Visual C++ 2015 Redistributable (x86)`_ The C++ DLL requires the `Visual C++ 2017 Redistributable (x86)`_
to be installed. to be installed.
To use the wrapper, copy both files to wherever you want to import them from To use the wrapper, copy both files to wherever you want to import them from
(they must be in the same folder), and you're done! (they must be in the same folder), and you're done!
.. _Visual C++ 2015 Redistributable (x86): https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe .. _Visual C++ 2017 Redistributable (x86): https://download.visualstudio.microsoft.com/download/pr/749aa419-f9e4-4578-a417-a43786af205e/d59197078cc425377be301faba7dd87a/vc_redist.x86.exe
Using the wrapper Using the wrapper
================= =================
@@ -28,7 +28,7 @@ To check if the module loaded is compatible with the version of the API that you
developed against:: developed against::
>>> import loot_api >>> import loot_api
>>> loot_api.is_compatible(0,12,0) >>> loot_api.is_compatible(0,14,0)
True True
>>> loot_api.is_compatible(0,9,0) >>> loot_api.is_compatible(0,9,0)
False False
+29 -20
View File
@@ -31,20 +31,24 @@ PluginTags GetPluginTags(const std::shared_ptr<DatabaseInterface> db, const std:
PluginTags tags; PluginTags tags;
auto metadata = db->GetPluginMetadata(plugin, false, evaluateConditions); auto metadata = db->GetPluginMetadata(plugin, false, evaluateConditions);
for (const auto &tag : metadata.GetTags()) { if (metadata.has_value()) {
if (tag.IsAddition()) for (const auto &tag : metadata.value().GetTags()) {
tags.added.insert(tag.GetName()); if (tag.IsAddition())
else tags.added.insert(tag.GetName());
tags.removed.insert(tag.GetName()); else
tags.removed.insert(tag.GetName());
}
} }
metadata = db->GetPluginUserMetadata(plugin, evaluateConditions); metadata = db->GetPluginUserMetadata(plugin, evaluateConditions);
tags.userlist_modified = !metadata.GetTags().empty(); if (metadata.has_value()) {
for (const auto &tag : metadata.GetTags()) { tags.userlist_modified = !metadata.value().GetTags().empty();
if (tag.IsAddition()) for (const auto &tag : metadata.value().GetTags()) {
tags.added.insert(tag.GetName()); if (tag.IsAddition())
else tags.added.insert(tag.GetName());
tags.removed.insert(tag.GetName()); else
tags.removed.insert(tag.GetName());
}
} }
return tags; return tags;
@@ -53,22 +57,27 @@ PluginTags GetPluginTags(const std::shared_ptr<DatabaseInterface> db, const std:
PluginCleanliness GetPluginCleanliness(const std::shared_ptr<DatabaseInterface> db, const std::string& plugin, bool evaluateConditions) { PluginCleanliness GetPluginCleanliness(const std::shared_ptr<DatabaseInterface> db, const std::string& plugin, bool evaluateConditions) {
auto metadata = db->GetPluginMetadata(plugin, true, evaluateConditions); auto metadata = db->GetPluginMetadata(plugin, true, evaluateConditions);
if (metadata.GetDirtyInfo().empty()) { if (!metadata.has_value()) {
if (metadata.GetCleanInfo().empty()) {
return PluginCleanliness::unknown;
} else {
return PluginCleanliness::clean;
}
} else if (!metadata.GetCleanInfo().empty()) {
return PluginCleanliness::unknown; return PluginCleanliness::unknown;
} }
for (const auto& info : metadata.GetDirtyInfo()) { auto dirtyInfo = metadata.value().GetDirtyInfo();
auto cleanInfo = metadata.value().GetCleanInfo();
if (dirtyInfo.empty() == cleanInfo.empty()) {
return PluginCleanliness::unknown;
}
if (!cleanInfo.empty()) {
return PluginCleanliness::clean;
}
for (const auto& info : dirtyInfo) {
if (info.ChooseInfo("en").GetText().find("Do not clean") != std::string::npos) { if (info.ChooseInfo("en").GetText().find("Do not clean") != std::string::npos) {
return PluginCleanliness::do_not_clean; return PluginCleanliness::do_not_clean;
} }
} }
return PluginCleanliness::unknown; return PluginCleanliness::dirty;
} }
} }
+30 -6
View File
@@ -34,8 +34,32 @@ using pybind11::arg;
using pybind11::enum_; using pybind11::enum_;
using pybind11::class_; using pybind11::class_;
using pybind11::metaclass; using pybind11::metaclass;
using std::filesystem::path;
using std::filesystem::u8path;
namespace loot { namespace loot {
namespace py {
std::shared_ptr<GameInterface> CreateGameHandle(GameType gameType, std::string gamePath, std::string gameLocalPath) {
return CreateGameHandle(gameType, u8path(gamePath), u8path(gameLocalPath));
}
void LoadLists(std::shared_ptr<DatabaseInterface> db, std::string masterlistPath, std::string userlistPath) {
return db->LoadLists(u8path(masterlistPath), u8path(userlistPath));
}
void WriteMinimalList(std::shared_ptr<DatabaseInterface> db, std::string outputFile, bool overwrite) {
return db->WriteMinimalList(u8path(outputFile), overwrite);
}
bool UpdateMasterlist(std::shared_ptr<DatabaseInterface> db, std::string masterlistPath, std::string remoteUrl, std::string remoteBranch) {
return db->UpdateMasterlist(u8path(masterlistPath), remoteUrl, remoteBranch);
}
MasterlistInfo GetMasterlistRevision(std::shared_ptr<DatabaseInterface> db, std::string masterlistPath, bool getShortId) {
return db->GetMasterlistRevision(u8path(masterlistPath), getShortId);
}
}
void bindEnums(pybind11::module& module) { void bindEnums(pybind11::module& module) {
enum_<GameType>(module, "GameType") enum_<GameType>(module, "GameType")
.value("tes4", GameType::tes4) .value("tes4", GameType::tes4)
@@ -94,7 +118,7 @@ void bindVersionClasses(pybind11::module& module) {
.def_readonly_static("minor", &LootVersion::minor) .def_readonly_static("minor", &LootVersion::minor)
.def_readonly_static("patch", &LootVersion::patch) .def_readonly_static("patch", &LootVersion::patch)
.def_readonly_static("revision", &LootVersion::revision) .def_readonly_static("revision", &LootVersion::revision)
.def_static("string", LootVersion::string); .def_static("string", LootVersion::GetVersionString);
class_<WrapperVersion>(module, "WrapperVersion") class_<WrapperVersion>(module, "WrapperVersion")
.def_readonly_static("major", &WrapperVersion::major) .def_readonly_static("major", &WrapperVersion::major)
@@ -110,9 +134,9 @@ void bindInterfaceClasses(pybind11::module& module) {
.def("get_database", &GameInterface::GetDatabase); .def("get_database", &GameInterface::GetDatabase);
class_<DatabaseInterface, std::shared_ptr<DatabaseInterface>>(module, "DatabaseInterface") class_<DatabaseInterface, std::shared_ptr<DatabaseInterface>>(module, "DatabaseInterface")
.def("load_lists", &DatabaseInterface::LoadLists, arg("masterlist_path"), arg("userlist_path") = "") .def("load_lists", &py::LoadLists, arg("masterlist_path"), arg("userlist_path") = "")
.def("update_masterlist", &DatabaseInterface::UpdateMasterlist) .def("update_masterlist", &py::UpdateMasterlist)
.def("get_masterlist_revision", &DatabaseInterface::GetMasterlistRevision) .def("get_masterlist_revision", &py::GetMasterlistRevision)
.def("get_plugin_metadata", &DatabaseInterface::GetPluginMetadata, .def("get_plugin_metadata", &DatabaseInterface::GetPluginMetadata,
arg("plugin"), arg("plugin"),
arg("includeUserMetadata") = true, arg("includeUserMetadata") = true,
@@ -123,7 +147,7 @@ void bindInterfaceClasses(pybind11::module& module) {
.def("get_plugin_cleanliness", &GetPluginCleanliness, .def("get_plugin_cleanliness", &GetPluginCleanliness,
arg("plugin"), arg("plugin"),
arg("evaluateConditions") = false) arg("evaluateConditions") = false)
.def("write_minimal_list", &DatabaseInterface::WriteMinimalList); .def("write_minimal_list", &py::WriteMinimalList);
} }
void bindClasses(pybind11::module& module) { void bindClasses(pybind11::module& module) {
@@ -139,7 +163,7 @@ void bindFunctions(pybind11::module& module) {
module.def("initialise_locale", &InitialiseLocale, arg("id") = ""); module.def("initialise_locale", &InitialiseLocale, arg("id") = "");
module.def("create_game_handle", &CreateGameHandle, module.def("create_game_handle", &py::CreateGameHandle,
arg("game"), arg("game"),
arg("game_path"), arg("game_path"),
arg("game_local_path") = ""); arg("game_local_path") = "");
+3 -3
View File
@@ -25,9 +25,9 @@
#include "wrapper_version.h" #include "wrapper_version.h"
namespace loot { namespace loot {
const unsigned int WrapperVersion::major = 3; const unsigned int WrapperVersion::major = 4;
const unsigned int WrapperVersion::minor = 1; const unsigned int WrapperVersion::minor = 0;
const unsigned int WrapperVersion::patch = 1; const unsigned int WrapperVersion::patch = 2;
const std::string WrapperVersion::revision = "@GIT_COMMIT_STRING@"; const std::string WrapperVersion::revision = "@GIT_COMMIT_STRING@";
std::string WrapperVersion::string() { std::string WrapperVersion::string() {
+54
View File
@@ -0,0 +1,54 @@
plugins:
- name: Oblivion.esm
msg:
- type: error
content: 'This must not be activated. However, it can be useful when porting Oblivion mods to Nehrim.'
- name: Unofficial Oblivion Patch.esp
tag:
- Actors.ACBS
- Actors.AIData
- Actors.AIPackages
- Actors.CombatStyle
- Actors.DeathItem
- Actors.Stats
- C.Climate
- C.Light
- C.Music
- C.Name
- C.Owner
- Creatures.Blood
- Delev
- Factions
- Invent
- Names
- NPC.Class
- Relations
- Relev
- Scripts
- Stats
- -C.Water
- name: clean_and_dirty.esp
dirty:
- crc: 0xDEADBEEF
util: '[TES4Edit v4.0.0](https://www.nexusmods.com/oblivion/mods/11536)'
clean:
- crc: 0xFEEDFACE
util: 'TES4Edit v4.0.0'
- name: clean.esp
clean:
- crc: 0xFEEDFACE
util: 'TES4Edit v4.0.0'
- name: dirty.esp
dirty:
- crc: 0xDEADBEEF
util: '[TES4Edit v4.0.0](https://www.nexusmods.com/oblivion/mods/11536)'
- name: do_not_clean.esp
dirty:
- crc: 0xDEADBEEF
util: '[TES4Edit v4.0.0](https://www.nexusmods.com/oblivion/mods/11536)'
info: 'Do not clean. This plugin is intentionally left dirty.'
+49 -9
View File
@@ -1,14 +1,20 @@
#!/usr/bin/env python #!/usr/bin/env python
import cProfile import cProfile
import os
import os.path import os.path
import shutil import shutil
import sys
import unittest import unittest
sys.path.append(os.getcwd())
from loot_api import Version from loot_api import Version
from loot_api import WrapperVersion from loot_api import WrapperVersion
from loot_api import GameType from loot_api import GameType
from loot_api import SimpleMessage from loot_api import SimpleMessage
from loot_api import MessageType from loot_api import MessageType
from loot_api import PluginCleanliness
from loot_api import create_game_handle from loot_api import create_game_handle
from loot_api import is_compatible from loot_api import is_compatible
from loot_api import set_logging_callback from loot_api import set_logging_callback
@@ -40,22 +46,22 @@ class GameFixture(unittest.TestCase):
class TestLootApi(GameFixture): class TestLootApi(GameFixture):
def test_is_compatible(self): def test_is_compatible(self):
self.assertFalse(is_compatible(0, 9, 0)) self.assertFalse(is_compatible(0, 9, 0))
self.assertTrue(is_compatible(0, 13, 0)) self.assertTrue(is_compatible(0, 14, 0))
def test_version(self): def test_version(self):
self.assertEqual(Version.major, 0) self.assertEqual(Version.major, 0)
self.assertEqual(Version.minor, 13) self.assertEqual(Version.minor, 14)
self.assertEqual(Version.patch, 2) self.assertEqual(Version.patch, 5)
self.assertNotEqual(Version.revision, u'') self.assertNotEqual(Version.revision, u'')
self.assertEqual(Version.string(), "0.13.2") self.assertEqual(Version.string(), "0.14.5")
def test_wrapper_version(self): def test_wrapper_version(self):
self.assertEqual(WrapperVersion.major, 3) self.assertEqual(WrapperVersion.major, 4)
self.assertEqual(WrapperVersion.minor, 1) self.assertEqual(WrapperVersion.minor, 0)
self.assertEqual(WrapperVersion.patch, 1) self.assertEqual(WrapperVersion.patch, 2)
self.assertNotEqual(WrapperVersion.revision, u'') self.assertNotEqual(WrapperVersion.revision, u'')
self.assertNotEqual(WrapperVersion.revision, Version.revision) self.assertNotEqual(WrapperVersion.revision, Version.revision)
self.assertEqual(WrapperVersion.string(), "3.1.1") self.assertEqual(WrapperVersion.string(), "4.0.2")
def test_create_db(self): def test_create_db(self):
game = create_game_handle(GameType.tes4, self.game_path, self.local_path) game = create_game_handle(GameType.tes4, self.game_path, self.local_path)
@@ -63,7 +69,7 @@ class TestLootApi(GameFixture):
self.assertNotEqual(db, None) self.assertNotEqual(db, None)
class TestDatabaseInterface(GameFixture): class TestDatabaseInterface(GameFixture):
masterlist_path = u'masterlist.yaml' masterlist_path = os.path.join(os.path.dirname(__file__), u'masterlist.yaml')
def setUp(self): def setUp(self):
super(TestDatabaseInterface, self).setUp() super(TestDatabaseInterface, self).setUp()
@@ -116,6 +122,40 @@ class TestDatabaseInterface(GameFixture):
self.assertEqual(messages[0].type, MessageType.error) self.assertEqual(messages[0].type, MessageType.error)
self.assertEqual(messages[0].text, u'This must not be activated. However, it can be useful when porting Oblivion mods to Nehrim.') self.assertEqual(messages[0].text, u'This must not be activated. However, it can be useful when porting Oblivion mods to Nehrim.')
def test_get_plugin_cleanliness_should_be_unknown_if_no_dirty_or_clean_metadata_exists(self):
self.db.load_lists(self.masterlist_path, u'')
cleanliness = self.db.get_plugin_cleanliness(u'unknown.esp')
self.assertEqual(cleanliness, PluginCleanliness.unknown)
def test_get_plugin_cleanliness_should_be_unknown_if_dirty_and_clean_metadata_exists(self):
self.db.load_lists(self.masterlist_path, u'')
cleanliness = self.db.get_plugin_cleanliness(u'clean_and_dirty.esp')
self.assertEqual(cleanliness, PluginCleanliness.unknown)
def test_get_plugin_cleanliness_should_be_clean_if_only_clean_metadata_exists(self):
self.db.load_lists(self.masterlist_path, u'')
cleanliness = self.db.get_plugin_cleanliness(u'clean.esp')
self.assertEqual(cleanliness, PluginCleanliness.clean)
def test_get_plugin_cleanliness_should_be_dirty_if_only_dirty_metadata_exists(self):
self.db.load_lists(self.masterlist_path, u'')
cleanliness = self.db.get_plugin_cleanliness(u'dirty.esp')
self.assertEqual(cleanliness, PluginCleanliness.dirty)
def test_get_plugin_cleanliness_should_be_do_not_clean_if_dirty_do_not_clean_info_exists(self):
self.db.load_lists(self.masterlist_path, u'')
cleanliness = self.db.get_plugin_cleanliness(u'do_not_clean.esp')
self.assertEqual(cleanliness, PluginCleanliness.do_not_clean)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()