pyside2 is the future for pyside support. Note pyside use Qt4 whereas pyside2 uses Qt5.
Showing the changes to tools/perf/scripts/python (1 of 1 file). Show all
Unified · Split
| @@ -27,18 +27,31 @@ import datetime · 26 unmodified lines | ||
| 27 | 27 | # |
| 28 | 28 | # fedora: |
| 29 | 29 | # |
| 30 | −# $ sudo yum install postgresql postgresql-server python-pyside qt-postgresql | |
| 30 | +# $ sudo yum install postgresql postgresql-server qt-postgresql | |
| 31 | 31 | # $ sudo su - postgres -c initdb |
| 32 | 32 | # $ sudo service postgresql start |
| 33 | 33 | # $ sudo su - postgres |
| 34 | −# $ createuser <your user id here> | |
| 34 | +# $ createuser -s <your user id here> # Older versions may not support -s, in which case answer the prompt below: | |
| 35 | 35 | # Shall the new role be a superuser? (y/n) y |
| 36 | +# $ sudo yum install python-pyside | |
| 37 | +# | |
| 38 | +# Alternately, to use Python3 and/or pyside 2, one of the following: | |
| 39 | +# $ sudo yum install python3-pyside | |
| 40 | +# $ pip install --user PySide2 | |
| 41 | +# $ pip3 install --user PySide2 | |
| 36 | 42 | # |
| 37 | 43 | # ubuntu: |
| 38 | 44 | # |
| 39 | −# $ sudo apt-get install postgresql python-pyside.qtsql libqt4-sql-psql | |
| 45 | +# $ sudo apt-get install postgresql | |
| 40 | 46 | # $ sudo su - postgres |
| 41 | 47 | # $ createuser -s <your user id here> |
| 48 | +# $ sudo apt-get install python-pyside.qtsql libqt4-sql-psql | |
| 49 | +# | |
| 50 | +# Alternately, to use Python3 and/or pyside 2, one of the following: | |
| 51 | +# | |
| 52 | +# $ sudo apt-get install python3-pyside.qtsql libqt4-sql-psql | |
| 53 | +# $ sudo apt-get install python-pyside2.qtsql libqt5sql5-psql | |
| 54 | +# $ sudo apt-get install python3-pyside2.qtsql libqt5sql5-psql | |
| 42 | 55 | # |
| 43 | 56 | # An example of using this script with Intel PT: |
| 44 | 57 | # |
| @@ -199,7 +212,16 @@ import datetime · 154 unmodified lines | ||
| 199 | 212 | # print "{0:>6} {1:>10} {2:>9} {3:<30} {4:>6} {5:<30}".format(query.value(0), query.value(1), query.value(2), query.value(3), query.value(4), query.value(5)) |
| 200 | 213 | # call_path_id = query.value(6) |
| 201 | 214 | |
| 202 | −from PySide.QtSql import * | |
| 215 | +pyside_version_1 = True | |
| 216 | +if not "pyside-version-1" in sys.argv: | |
| 217 | + try: | |
| 218 | + from PySide2.QtSql import * | |
| 219 | + pyside_version_1 = False | |
| 220 | + except: | |
| 221 | + pass | |
| 222 | + | |
| 223 | +if pyside_version_1: | |
| 224 | + from PySide.QtSql import * | |
| 203 | 225 | |
| 204 | 226 | if sys.version_info < (3, 0): |
| 205 | 227 | def toserverstr(str): |
| @@ -255,11 +277,12 @@ def printdate(*args, **kw_args): · 49 unmodified lines | ||
| 255 | 277 | print(datetime.datetime.today(), *args, sep=' ', **kw_args) |
| 256 | 278 | |
| 257 | 279 | def usage(): |
| 258 | − printerr("Usage is: export-to-postgresql.py <database name> [<columns>] [<calls>] [<callchains>]") | |
| 259 | − printerr("where: columns 'all' or 'branches'") | |
| 260 | − printerr(" calls 'calls' => create calls and call_paths table") | |
| 261 | − printerr(" callchains 'callchains' => create call_paths table") | |
| 262 | − raise Exception("Too few arguments") | |
| 280 | + printerr("Usage is: export-to-postgresql.py <database name> [<columns>] [<calls>] [<callchains>] [<pyside-version-1>]"); | |
| 281 | + printerr("where: columns 'all' or 'branches'"); | |
| 282 | + printerr(" calls 'calls' => create calls and call_paths table"); | |
| 283 | + printerr(" callchains 'callchains' => create call_paths table"); | |
| 284 | + printerr(" pyside-version-1 'pyside-version-1' => use pyside version 1"); | |
| 285 | + raise Exception("Too few or bad arguments") | |
| 263 | 286 | |
| 264 | 287 | if (len(sys.argv) < 2): |
| 265 | 288 | usage() |
| @@ -281,6 +304,8 @@ for i in range(3,len(sys.argv)): · 15 unmodified lines | ||
| 281 | 304 | perf_db_export_calls = True |
| 282 | 305 | elif (sys.argv[i] == "callchains"): |
| 283 | 306 | perf_db_export_callchains = True |
| 307 | + elif (sys.argv[i] == "pyside-version-1"): | |
| 308 | + pass | |
| 284 | 309 | else: |
| 285 | 310 | usage() |
| 286 | 311 | |