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>
This commit is contained in:
parent
655219636b
commit
178f81aa70
7 changed files with 31 additions and 8 deletions
|
|
@ -8,8 +8,8 @@ include(PySideModules)
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in"
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/global.h" @ONLY)
|
"${CMAKE_CURRENT_BINARY_DIR}/global.h" @ONLY)
|
||||||
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/__init__.py"
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in"
|
||||||
"${CMAKE_BINARY_DIR}/PySide/__init__.py")
|
"${CMAKE_CURRENT_BINARY_DIR}/__init__.py" @ONLY)
|
||||||
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/private.py"
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/private.py"
|
||||||
"${CMAKE_BINARY_DIR}/PySide/private.py")
|
"${CMAKE_BINARY_DIR}/PySide/private.py")
|
||||||
|
|
|
||||||
5
PySide/QtCore/glue/qt_version.cpp
Normal file
5
PySide/QtCore/glue/qt_version.cpp
Normal file
|
|
@ -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);
|
||||||
|
|
@ -596,10 +596,7 @@
|
||||||
</inject-code>
|
</inject-code>
|
||||||
</add-function>
|
</add-function>
|
||||||
|
|
||||||
<inject-code class="target" position="end">
|
<inject-code class="target" position="end" file="glue/qt_version.cpp" />
|
||||||
PyModule_AddIntConstant(module, "QT_VERSION", QT_VERSION);
|
|
||||||
PyModule_AddStringConstant(module, "QT_VERSION_STR", QT_VERSION_STR);
|
|
||||||
</inject-code>
|
|
||||||
|
|
||||||
<add-function signature="__moduleShutdown()">
|
<add-function signature="__moduleShutdown()">
|
||||||
<inject-code class="target" position="beginning">
|
<inject-code class="target" position="beginning">
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
__all__ = ['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtSql', 'QtSvg', 'QtTest', 'QtWebKit', 'QtScript']
|
|
||||||
import private
|
|
||||||
5
PySide/__init__.py.in
Normal file
5
PySide/__init__.py.in
Normal file
|
|
@ -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@)
|
||||||
|
|
@ -63,4 +63,5 @@ add_dependencies(testbinding pyside QtCore libpyside pysidetest)
|
||||||
|
|
||||||
|
|
||||||
PYSIDE_TEST(homonymoussignalandmethod_test.py)
|
PYSIDE_TEST(homonymoussignalandmethod_test.py)
|
||||||
|
PYSIDE_TEST(version_test.py)
|
||||||
|
|
||||||
|
|
|
||||||
17
tests/pysidetest/version_test.py
Normal file
17
tests/pysidetest/version_test.py
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
from PySide import __version_info__, __version__, QtCore
|
||||||
|
|
||||||
|
class CheckForVariablesTest(unittest.TestCase):
|
||||||
|
def testVesions(self):
|
||||||
|
self.assert_(__version_info__ >= (1, 0, 0))
|
||||||
|
self.assert_(__version_info__ < (99, 99, 99))
|
||||||
|
self.assert_(__version__)
|
||||||
|
|
||||||
|
self.assert_(QtCore.__version_info__ >= (4, 5, 0))
|
||||||
|
self.assert_(QtCore.__version__)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue