mirror of
https://github.com/loot/libloot-python.git
synced 2026-07-27 14:14:13 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f97de90e02 | ||
|
|
d00c59b7b2 | ||
|
|
e06227f437 | ||
|
|
bcc536d4b0 | ||
|
|
a564f230be | ||
|
|
27c8f58494 | ||
|
|
179125f006 | ||
|
|
671ca81beb | ||
|
|
7faa360790 | ||
|
|
0c9d014174 | ||
|
|
a8e2b11280 |
+13
-5
@@ -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.1.1")
|
||||||
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.2/loot_api-0.13.2-0-g5956e60_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.2/loot-api.tar.xz")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
ExternalProject_Add(loot-api-c++
|
ExternalProject_Add(loot-api-c++
|
||||||
@@ -128,12 +128,20 @@ add_custom_command(TARGET loot_api POST_BUILD
|
|||||||
|
|
||||||
install(TARGETS loot_api
|
install(TARGETS loot_api
|
||||||
DESTINATION "."
|
DESTINATION "."
|
||||||
CONFIGURATIONS Release)
|
CONFIGURATIONS Release RelWithDebInfo)
|
||||||
|
|
||||||
install(FILES "${LOOT_API_EXTRACTED_PATH}/${LOOT_API_SHARED_LIBRARY}"
|
install(FILES "${LOOT_API_EXTRACTED_PATH}/${LOOT_API_SHARED_LIBRARY}"
|
||||||
"${CMAKE_SOURCE_DIR}/docs/README.md"
|
"${CMAKE_SOURCE_DIR}/docs/README.md"
|
||||||
DESTINATION "."
|
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
|
# CPack
|
||||||
|
|||||||
+3
-3
@@ -2,7 +2,7 @@ os: Visual Studio 2015
|
|||||||
|
|
||||||
version: "{build}-{branch}"
|
version: "{build}-{branch}"
|
||||||
|
|
||||||
configuration: Release
|
configuration: RelWithDebInfo
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
bintray_auth_token:
|
bintray_auth_token:
|
||||||
@@ -22,12 +22,12 @@ build:
|
|||||||
project: 'c:\projects\loot-api-python\build\loot_api_python.sln'
|
project: 'c:\projects\loot-api-python\build\loot_api_python.sln'
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- cd %APPVEYOR_BUILD_FOLDER%\build\Release
|
- cd %APPVEYOR_BUILD_FOLDER%\build\%CONFIGURATION%
|
||||||
- python -m unittest test
|
- python -m unittest test
|
||||||
|
|
||||||
after_test:
|
after_test:
|
||||||
- cd %APPVEYOR_BUILD_FOLDER%\build
|
- cd %APPVEYOR_BUILD_FOLDER%\build
|
||||||
- cpack
|
- cpack -C %CONFIGURATION%
|
||||||
# AppVeyor checks out a specific commit, but that means the archive script
|
# 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.
|
# 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", ""
|
- ps: $env:GIT_DESCRIBE = ((git describe --tags --long --always) | Out-String) -replace "`n|`r", ""
|
||||||
|
|||||||
+4
-3
@@ -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
@@ -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'])
|
||||||
|
|||||||
+11
-7
@@ -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,19 +137,21 @@ 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") = "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PYBIND11_MODULE(loot_api, module) {
|
PYBIND11_PLUGIN(loot_api) {
|
||||||
module.doc() = "A Python module that wraps the LOOT API, generated by pybind11.";
|
pybind11::module module("loot_api", "A Python module that wraps the LOOT API, generated by pybind11.");
|
||||||
|
|
||||||
loot::bindEnums(module);
|
loot::bindEnums(module);
|
||||||
loot::bindClasses(module);
|
loot::bindClasses(module);
|
||||||
loot::bindFunctions(module);
|
loot::bindFunctions(module);
|
||||||
|
|
||||||
|
return module.ptr();
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-8
@@ -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, 2)
|
||||||
self.assertNotEqual(Version.revision, u'')
|
self.assertNotEqual(Version.revision, u'')
|
||||||
self.assertEqual(Version.string(), "0.12.0")
|
self.assertEqual(Version.string(), "0.13.2")
|
||||||
|
|
||||||
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, 1)
|
||||||
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.1")
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
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 = 1;
|
||||||
const std::string WrapperVersion::revision = "@GIT_COMMIT_STRING@";
|
const std::string WrapperVersion::revision = "@GIT_COMMIT_STRING@";
|
||||||
|
|
||||||
std::string WrapperVersion::string() {
|
std::string WrapperVersion::string() {
|
||||||
|
|||||||
Reference in New Issue
Block a user