11 Commits
Author SHA1 Message Date
Oliver Hamlet f97de90e02 Update wrapper version to 3.1.1 2018-05-12 21:50:30 +01:00
Oliver Hamlet d00c59b7b2 Update LOOT API to v0.13.2 2018-05-12 21:15:17 +01:00
Oliver Hamlet e06227f437 Build with debug info and package PDB 2018-05-12 19:26:21 +01:00
Oliver Hamlet bcc536d4b0 Downgrade to pybind11 v2.1.1
Updating to v2.2.1 introduced a runtime issue that's
environment-specific but it's not clear what the issue is, so
just downgrade for now.
2018-05-12 19:12:47 +01:00
Oliver Hamlet a564f230be Update wrapper version to 3.1.0
Although the LOOT API update includes breaking changes, none of them are
exposed by the Python wrapper, so this is just a minor update.
2018-04-15 13:16:49 +01:00
Oliver Hamlet 27c8f58494 Update pybind11 to v2.2.2 2018-04-15 13:16:49 +01:00
Oliver Hamlet 179125f006 Expose GameType::tes5vr and GameType::fo4vr 2018-04-15 13:16:49 +01:00
Oliver Hamlet 671ca81beb Update to LOOT API v0.13.1 2018-04-15 13:16:49 +01:00
Oliver Hamlet 7faa360790 Update outdated usage example 2017-12-30 15:29:21 +00:00
Oliver Hamlet 0c9d014174 Remove default value for create_game_handle's game_path argument
The LOOT API incorrectly allows it, it causes a runtime exception.
2017-12-30 15:29:03 +00:00
Oliver Hamlet a8e2b11280 Allow initialise_locale() to be called with no args
Use a blank string as the default argument, as it's the most commonly desired value.
2017-12-30 15:27:48 +00:00
7 changed files with 45 additions and 31 deletions
+13 -5
View File
@@ -30,7 +30,7 @@ configure_file("${CMAKE_SOURCE_DIR}/src/wrapper_version.cpp.in" "${CMAKE_BINARY_
# pybind11
#######################################
set(PYBIND11_VERSION "2.2.1")
set(PYBIND11_VERSION "2.1.1")
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_EXTRACTED_PATH "${EXTERNAL_PROJECTS_PATH}/pybind11-${PYBIND11_VERSION}")
@@ -50,9 +50,9 @@ add_subdirectory(${PYBIND11_EXTRACTED_PATH})
#######################################
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(LOOT_API_URL "https://github.com/loot/loot-api/releases/download/0.12.0/loot_api-0.12.0-0-g42cacca_dev-win32.7z")
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")
else()
set(LOOT_API_URL "https://github.com/loot/loot-api/releases/download/0.12.0/loot-api.tar.xz")
set(LOOT_API_URL "https://github.com/loot/loot-api/releases/download/0.13.2/loot-api.tar.xz")
endif()
ExternalProject_Add(loot-api-c++
@@ -128,12 +128,20 @@ add_custom_command(TARGET loot_api POST_BUILD
install(TARGETS loot_api
DESTINATION "."
CONFIGURATIONS Release)
CONFIGURATIONS Release RelWithDebInfo)
install(FILES "${LOOT_API_EXTRACTED_PATH}/${LOOT_API_SHARED_LIBRARY}"
"${CMAKE_SOURCE_DIR}/docs/README.md"
DESTINATION "."
CONFIGURATIONS Release)
CONFIGURATIONS Release RelWithDebInfo)
IF (MSVC)
install(FILES $<TARGET_PDB_FILE:loot_api>
DESTINATION .
OPTIONAL
CONFIGURATIONS RelWithDebInfo
RENAME loot_api_python.pdb)
ENDIF ()
########################################
# CPack
+3 -3
View File
@@ -2,7 +2,7 @@ os: Visual Studio 2015
version: "{build}-{branch}"
configuration: Release
configuration: RelWithDebInfo
environment:
bintray_auth_token:
@@ -22,12 +22,12 @@ build:
project: 'c:\projects\loot-api-python\build\loot_api_python.sln'
test_script:
- cd %APPVEYOR_BUILD_FOLDER%\build\Release
- cd %APPVEYOR_BUILD_FOLDER%\build\%CONFIGURATION%
- python -m unittest test
after_test:
- cd %APPVEYOR_BUILD_FOLDER%\build
- cpack
- cpack -C %CONFIGURATION%
# AppVeyor checks out a specific commit, but that means the archive script
# can't tell which branch it's on, so rename the 7z archives.
- ps: $env:GIT_DESCRIBE = ((git describe --tags --long --always) | Out-String) -replace "`n|`r", ""
+4 -3
View File
@@ -136,12 +136,13 @@ Functions
Checks for API compatibility. Wraps :cpp:func:`loot::IsCompatible`.
.. py:function:: loot_api.InitialiseLocale(unicode) -> NoneType
.. py:function:: loot_api.InitialiseLocale(unicode = u'') -> NoneType
Initialise the current global locale using the given ID. Wraps
Initialise the current global locale using the given ID. A blank value means
that the system default locale will be initialised. Wraps
:cpp:func:`loot::InitialiseLocale`.
.. py:function:: loot_api.create_game_handle(game : loot_api.GameType, [game_path : unicode = u'', [game_local_path : unicode = u'']]) -> loot_api.GameInterface
.. py:function:: loot_api.create_game_handle(game : loot_api.GameType, game_path : unicode, [game_local_path : unicode = u'']) -> loot_api.GameInterface
Initialise a new game handle. Wraps :cpp:func:`loot::CreateGameHandle`.
+4 -3
View File
@@ -28,7 +28,7 @@ To check if the module loaded is compatible with the version of the API that you
developed against::
>>> import loot_api
>>> loot_api.is_compatible(0,10,0)
>>> loot_api.is_compatible(0,12,0)
True
>>> loot_api.is_compatible(0,9,0)
False
@@ -39,8 +39,9 @@ Getting a Plugin's Bash Tag Suggestions
To get a plugin's Bash Tag suggestions from a ``masterlist.yaml`` metadata file::
>>> import loot_api
>>> db = loot_api.create_database(loot_api.GameType.tes4, '', '')
>>> db.load_lists('masterlist.yaml', '')
>>> loot_api.initialise_locale()
>>> db = loot_api.create_game_handle(loot_api.GameType.tes4, 'C:\\path\\to\\oblivion\\directory')
>>> db.load_lists('masterlist.yaml')
>>> tags = db.get_plugin_tags(u'Unofficial Oblivion Patch.esp')
>>> tags.added
set([u'Scripts', u'Relations', u'C.Owner', u'Actors.AIPackages', u'Actors.Stats', u'Actors.ACBS', u'C.Music', u'Factions', u'Invent', u'Relev', u'Names', u'C.Light', u'Delev', u'C.Name', u'C.Climate', u'NPC.Class', u'Stats', u'Actors.DeathItem', u'Creatures.Blood', u'Actors.CombatStyle', u'Actors.AIData'])
+11 -7
View File
@@ -41,9 +41,11 @@ void bindEnums(pybind11::module& module) {
.value("tes4", GameType::tes4)
.value("tes5", GameType::tes5)
.value("tes5se", GameType::tes5se)
.value("tes5vr", GameType::tes5vr)
.value("fo3", GameType::fo3)
.value("fonv", GameType::fonv)
.value("fo4", GameType::fo4);
.value("fo4", GameType::fo4)
.value("fo4vr", GameType::fo4vr);
enum_<LogLevel>(module, "LogLevel")
.value("trace", LogLevel::trace)
@@ -135,19 +137,21 @@ void bindFunctions(pybind11::module& module) {
module.def("is_compatible", &IsCompatible);
module.def("initialise_locale", &InitialiseLocale);
module.def("initialise_locale", &InitialiseLocale, arg("id") = "");
module.def("create_game_handle", &CreateGameHandle,
arg("game"),
arg("game_path") = "",
module.def("create_game_handle", &CreateGameHandle,
arg("game"),
arg("game_path"),
arg("game_local_path") = "");
}
}
PYBIND11_MODULE(loot_api, module) {
module.doc() = "A Python module that wraps the LOOT API, generated by pybind11.";
PYBIND11_PLUGIN(loot_api) {
pybind11::module module("loot_api", "A Python module that wraps the LOOT API, generated by pybind11.");
loot::bindEnums(module);
loot::bindClasses(module);
loot::bindFunctions(module);
return module.ptr();
}
+8 -8
View File
@@ -18,7 +18,7 @@ def logging_callback(level, message):
pass
set_logging_callback(logging_callback)
initialise_locale("")
initialise_locale()
class GameFixture(unittest.TestCase):
game_path = os.path.join(u'.', u'Oblivion')
@@ -40,22 +40,22 @@ class GameFixture(unittest.TestCase):
class TestLootApi(GameFixture):
def test_is_compatible(self):
self.assertFalse(is_compatible(0, 9, 0))
self.assertTrue(is_compatible(0, 12, 0))
self.assertTrue(is_compatible(0, 13, 0))
def test_version(self):
self.assertEqual(Version.major, 0)
self.assertEqual(Version.minor, 12)
self.assertEqual(Version.patch, 0)
self.assertEqual(Version.minor, 13)
self.assertEqual(Version.patch, 2)
self.assertNotEqual(Version.revision, u'')
self.assertEqual(Version.string(), "0.12.0")
self.assertEqual(Version.string(), "0.13.2")
def test_wrapper_version(self):
self.assertEqual(WrapperVersion.major, 3)
self.assertEqual(WrapperVersion.minor, 0)
self.assertEqual(WrapperVersion.patch, 0)
self.assertEqual(WrapperVersion.minor, 1)
self.assertEqual(WrapperVersion.patch, 1)
self.assertNotEqual(WrapperVersion.revision, u'')
self.assertNotEqual(WrapperVersion.revision, Version.revision)
self.assertEqual(WrapperVersion.string(), "3.0.0")
self.assertEqual(WrapperVersion.string(), "3.1.1")
def test_create_db(self):
game = create_game_handle(GameType.tes4, self.game_path, self.local_path)
+2 -2
View File
@@ -26,8 +26,8 @@
namespace loot {
const unsigned int WrapperVersion::major = 3;
const unsigned int WrapperVersion::minor = 0;
const unsigned int WrapperVersion::patch = 0;
const unsigned int WrapperVersion::minor = 1;
const unsigned int WrapperVersion::patch = 1;
const std::string WrapperVersion::revision = "@GIT_COMMIT_STRING@";
std::string WrapperVersion::string() {