7 Commits
Author SHA1 Message Date
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
6 changed files with 26 additions and 22 deletions
+3 -3
View File
@@ -30,7 +30,7 @@ configure_file("${CMAKE_SOURCE_DIR}/src/wrapper_version.cpp.in" "${CMAKE_BINARY_
# pybind11 # pybind11
####################################### #######################################
set(PYBIND11_VERSION "2.2.1") set(PYBIND11_VERSION "2.2.2")
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,9 +50,9 @@ 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.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.1/loot_api-0.13.1-0-g1804e45_dev-win32.7z")
else() 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.1/loot-api.tar.xz")
endif() endif()
ExternalProject_Add(loot-api-c++ ExternalProject_Add(loot-api-c++
+4 -3
View File
@@ -136,12 +136,13 @@ Functions
Checks for API compatibility. Wraps :cpp:func:`loot::IsCompatible`. 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`. :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`. 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:: developed against::
>>> import loot_api >>> import loot_api
>>> loot_api.is_compatible(0,10,0) >>> loot_api.is_compatible(0,12,0)
True True
>>> loot_api.is_compatible(0,9,0) >>> loot_api.is_compatible(0,9,0)
False 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:: To get a plugin's Bash Tag suggestions from a ``masterlist.yaml`` metadata file::
>>> import loot_api >>> import loot_api
>>> db = loot_api.create_database(loot_api.GameType.tes4, '', '') >>> loot_api.initialise_locale()
>>> db.load_lists('masterlist.yaml', '') >>> 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 = db.get_plugin_tags(u'Unofficial Oblivion Patch.esp')
>>> tags.added >>> 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']) 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'])
+7 -5
View File
@@ -41,9 +41,11 @@ void bindEnums(pybind11::module& module) {
.value("tes4", GameType::tes4) .value("tes4", GameType::tes4)
.value("tes5", GameType::tes5) .value("tes5", GameType::tes5)
.value("tes5se", GameType::tes5se) .value("tes5se", GameType::tes5se)
.value("tes5vr", GameType::tes5vr)
.value("fo3", GameType::fo3) .value("fo3", GameType::fo3)
.value("fonv", GameType::fonv) .value("fonv", GameType::fonv)
.value("fo4", GameType::fo4); .value("fo4", GameType::fo4)
.value("fo4vr", GameType::fo4vr);
enum_<LogLevel>(module, "LogLevel") enum_<LogLevel>(module, "LogLevel")
.value("trace", LogLevel::trace) .value("trace", LogLevel::trace)
@@ -135,11 +137,11 @@ void bindFunctions(pybind11::module& module) {
module.def("is_compatible", &IsCompatible); module.def("is_compatible", &IsCompatible);
module.def("initialise_locale", &InitialiseLocale); module.def("initialise_locale", &InitialiseLocale, arg("id") = "");
module.def("create_game_handle", &CreateGameHandle, module.def("create_game_handle", &CreateGameHandle,
arg("game"), arg("game"),
arg("game_path") = "", arg("game_path"),
arg("game_local_path") = ""); arg("game_local_path") = "");
} }
} }
+7 -7
View File
@@ -18,7 +18,7 @@ def logging_callback(level, message):
pass pass
set_logging_callback(logging_callback) set_logging_callback(logging_callback)
initialise_locale("") initialise_locale()
class GameFixture(unittest.TestCase): class GameFixture(unittest.TestCase):
game_path = os.path.join(u'.', u'Oblivion') game_path = os.path.join(u'.', u'Oblivion')
@@ -40,22 +40,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, 12, 0)) self.assertTrue(is_compatible(0, 13, 0))
def test_version(self): def test_version(self):
self.assertEqual(Version.major, 0) self.assertEqual(Version.major, 0)
self.assertEqual(Version.minor, 12) self.assertEqual(Version.minor, 13)
self.assertEqual(Version.patch, 0) self.assertEqual(Version.patch, 1)
self.assertNotEqual(Version.revision, u'') self.assertNotEqual(Version.revision, u'')
self.assertEqual(Version.string(), "0.12.0") self.assertEqual(Version.string(), "0.13.1")
def test_wrapper_version(self): def test_wrapper_version(self):
self.assertEqual(WrapperVersion.major, 3) self.assertEqual(WrapperVersion.major, 3)
self.assertEqual(WrapperVersion.minor, 0) self.assertEqual(WrapperVersion.minor, 1)
self.assertEqual(WrapperVersion.patch, 0) self.assertEqual(WrapperVersion.patch, 0)
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.0.0") self.assertEqual(WrapperVersion.string(), "3.1.0")
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)
+1 -1
View File
@@ -26,7 +26,7 @@
namespace loot { namespace loot {
const unsigned int WrapperVersion::major = 3; const unsigned int WrapperVersion::major = 3;
const unsigned int WrapperVersion::minor = 0; const unsigned int WrapperVersion::minor = 1;
const unsigned int WrapperVersion::patch = 0; const unsigned int WrapperVersion::patch = 0;
const std::string WrapperVersion::revision = "@GIT_COMMIT_STRING@"; const std::string WrapperVersion::revision = "@GIT_COMMIT_STRING@";