diff options
author | renatofilho <renato.filho@openbossa.org> | 2010-11-12 08:52:09 -0300 |
---|---|---|
committer | renatofilho <renato.filho@openbossa.org> | 2010-11-12 14:25:27 -0300 |
commit | 178f81aa70711876fe492431ae32afa3538cf460 (patch) | |
tree | 08da3637fb25f36969e8e61daaf1700dc611dea6 /PySide | |
parent | 655219636b1500e82d543914045f4cc7ba7db95f (diff) |
Added PySide attributes to specify current version, and Qt version.
Fixes bug: #454
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'PySide')
-rw-r--r-- | PySide/CMakeLists.txt | 4 | ||||
-rw-r--r-- | PySide/QtCore/glue/qt_version.cpp | 5 | ||||
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 5 | ||||
-rw-r--r-- | PySide/__init__.py | 2 | ||||
-rw-r--r-- | PySide/__init__.py.in | 5 |
5 files changed, 13 insertions, 8 deletions
diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt index c4aaf64ad..d7030d8ac 100644 --- a/PySide/CMakeLists.txt +++ b/PySide/CMakeLists.txt @@ -8,8 +8,8 @@ include(PySideModules) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in" "${CMAKE_CURRENT_BINARY_DIR}/global.h" @ONLY) -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/__init__.py" - "${CMAKE_BINARY_DIR}/PySide/__init__.py") +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in" + "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" @ONLY) execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/private.py" "${CMAKE_BINARY_DIR}/PySide/private.py") diff --git a/PySide/QtCore/glue/qt_version.cpp b/PySide/QtCore/glue/qt_version.cpp new file mode 100644 index 000000000..66f8c0049 --- /dev/null +++ b/PySide/QtCore/glue/qt_version.cpp @@ -0,0 +1,5 @@ +QList<QByteArray> version = QByteArray(qVersion()).split('.'); +PyObject *pyQtVersion = Shiboken::makeTuple(version[0].toInt(), version[1].toInt(), version[2].toInt()); + +PyModule_AddStringConstant(module, "__version__", qVersion()); +PyModule_AddObject(module, "__version_info__", pyQtVersion); diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index e542ea693..c5d3ac552 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -596,10 +596,7 @@ </inject-code> </add-function> - <inject-code class="target" position="end"> - PyModule_AddIntConstant(module, "QT_VERSION", QT_VERSION); - PyModule_AddStringConstant(module, "QT_VERSION_STR", QT_VERSION_STR); - </inject-code> + <inject-code class="target" position="end" file="glue/qt_version.cpp" /> <add-function signature="__moduleShutdown()"> <inject-code class="target" position="beginning"> diff --git a/PySide/__init__.py b/PySide/__init__.py deleted file mode 100644 index c93c5df6b..000000000 --- a/PySide/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -__all__ = ['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtSql', 'QtSvg', 'QtTest', 'QtWebKit', 'QtScript'] -import private diff --git a/PySide/__init__.py.in b/PySide/__init__.py.in new file mode 100644 index 000000000..f931fadca --- /dev/null +++ b/PySide/__init__.py.in @@ -0,0 +1,5 @@ +__all__ = ['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtSql', 'QtSvg', 'QtTest', 'QtWebKit', 'QtScript'] +import private + +__version__ = "@BINDING_API_VERSION@" +__version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDING_API_MICRO_VERSION@) |