aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2020-10-27 20:12:12 +0100
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2020-10-28 13:56:40 +0000
commit1fceed1fc3565080eef556c9b71498780aa94bf2 (patch)
tree848628ec5561e8c90d19cf3996f1047d39ab7928 /examples
parent1bc8c8ce262d80bbea0141f48055342adca9e3f9 (diff)
examples: Remove Python 2.7 and <3.6 related code
* removing from __future__ import ... * updating CMakeLists.txt files * removing special if-else for Python 2 and 3 Change-Id: I8a34b06b6b384ebc5323f20f7c15c357a5be6d62 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/extending/chapter1-basics/basics.py2
-rw-r--r--examples/declarative/extending/chapter2-methods/methods.py2
-rw-r--r--examples/declarative/extending/chapter3-bindings/bindings.py2
-rw-r--r--examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py2
-rw-r--r--examples/declarative/extending/chapter5-listproperties/listproperties.py2
-rw-r--r--examples/declarative/scrolling.py2
-rw-r--r--examples/declarative/signals/pytoqml1/main.py2
-rw-r--r--examples/declarative/signals/qmltopy1/main.py2
-rw-r--r--examples/declarative/signals/qmltopy2/main.py2
-rw-r--r--examples/declarative/signals/qmltopy3/main.py2
-rw-r--r--examples/declarative/signals/qmltopy4/main.py2
-rw-r--r--examples/declarative/usingmodel.py2
-rw-r--r--examples/installer_test/hello.py2
-rw-r--r--examples/network/fortuneclient.py8
-rw-r--r--examples/samplebinding/CMakeLists.txt4
-rw-r--r--examples/samplebinding/main.py2
-rw-r--r--examples/scriptableapplication/CMakeLists.txt2
-rw-r--r--examples/sql/books/bookwindow.py2
-rw-r--r--examples/utils/pyside2_config.py19
-rw-r--r--examples/widgetbinding/CMakeLists.txt2
-rw-r--r--examples/widgets/dialogs/classwizard/classwizard.py2
-rw-r--r--examples/widgets/richtext/syntaxhighlighter.py9
22 files changed, 10 insertions, 66 deletions
diff --git a/examples/declarative/extending/chapter1-basics/basics.py b/examples/declarative/extending/chapter1-basics/basics.py
index 95ee36362..e75e1b330 100644
--- a/examples/declarative/extending/chapter1-basics/basics.py
+++ b/examples/declarative/extending/chapter1-basics/basics.py
@@ -39,8 +39,6 @@
##
#############################################################################
-from __future__ import print_function
-
"""PySide2 port of the qml/tutorials/extending-qml/chapter1-basics example from Qt v5.x"""
import sys, os
diff --git a/examples/declarative/extending/chapter2-methods/methods.py b/examples/declarative/extending/chapter2-methods/methods.py
index 1d02628cd..e2a4eb804 100644
--- a/examples/declarative/extending/chapter2-methods/methods.py
+++ b/examples/declarative/extending/chapter2-methods/methods.py
@@ -39,8 +39,6 @@
##
#############################################################################
-from __future__ import print_function
-
"""PySide2 port of the qml/tutorials/extending-qml/chapter2-methods example from Qt v5.x"""
import sys, os
diff --git a/examples/declarative/extending/chapter3-bindings/bindings.py b/examples/declarative/extending/chapter3-bindings/bindings.py
index f20fc0bcc..b603cb65e 100644
--- a/examples/declarative/extending/chapter3-bindings/bindings.py
+++ b/examples/declarative/extending/chapter3-bindings/bindings.py
@@ -39,8 +39,6 @@
##
#############################################################################
-from __future__ import print_function
-
"""PySide2 port of the qml/tutorials/extending-qml/chapter3-bindings example from Qt v5.x"""
import sys, os
diff --git a/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py b/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
index 66e4dea7c..888cb4861 100644
--- a/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
+++ b/examples/declarative/extending/chapter4-customPropertyTypes/customPropertyTypes.py
@@ -39,8 +39,6 @@
##
#############################################################################
-from __future__ import print_function
-
"""PySide2 port of the qml/tutorials/extending-qml/chapter4-customPropertyTypes example from Qt v5.x"""
import sys, os
diff --git a/examples/declarative/extending/chapter5-listproperties/listproperties.py b/examples/declarative/extending/chapter5-listproperties/listproperties.py
index 659f8d5c5..5c3c428c2 100644
--- a/examples/declarative/extending/chapter5-listproperties/listproperties.py
+++ b/examples/declarative/extending/chapter5-listproperties/listproperties.py
@@ -39,8 +39,6 @@
##
#############################################################################
-from __future__ import print_function
-
"""PySide2 port of the qml/tutorials/extending-qml/chapter5-listproperties example from Qt v5.x"""
import sys, os
diff --git a/examples/declarative/scrolling.py b/examples/declarative/scrolling.py
index b4a0ee270..f4b740e02 100644
--- a/examples/declarative/scrolling.py
+++ b/examples/declarative/scrolling.py
@@ -39,8 +39,6 @@
##
#############################################################################
-from __future__ import print_function
-
import os
import sys
from PySide2.QtCore import QUrl
diff --git a/examples/declarative/signals/pytoqml1/main.py b/examples/declarative/signals/pytoqml1/main.py
index 218d885a0..b57809392 100644
--- a/examples/declarative/signals/pytoqml1/main.py
+++ b/examples/declarative/signals/pytoqml1/main.py
@@ -39,8 +39,6 @@
##
#############################################################################
-from __future__ import print_function
-
import os
import sys
from PySide2.QtCore import QTimer, QUrl
diff --git a/examples/declarative/signals/qmltopy1/main.py b/examples/declarative/signals/qmltopy1/main.py
index 1342dbadb..a2adfef29 100644
--- a/examples/declarative/signals/qmltopy1/main.py
+++ b/examples/declarative/signals/qmltopy1/main.py
@@ -39,8 +39,6 @@
##
#############################################################################
-from __future__ import print_function
-
import os
import sys
from PySide2.QtCore import QObject, QUrl, Slot
diff --git a/examples/declarative/signals/qmltopy2/main.py b/examples/declarative/signals/qmltopy2/main.py
index 9b0aca815..0fc6a2225 100644
--- a/examples/declarative/signals/qmltopy2/main.py
+++ b/examples/declarative/signals/qmltopy2/main.py
@@ -39,8 +39,6 @@
##
#############################################################################
-from __future__ import print_function
-
import os
import sys
from PySide2.QtCore import QObject, QUrl, Slot
diff --git a/examples/declarative/signals/qmltopy3/main.py b/examples/declarative/signals/qmltopy3/main.py
index 485dd62f5..0ba50fae8 100644
--- a/examples/declarative/signals/qmltopy3/main.py
+++ b/examples/declarative/signals/qmltopy3/main.py
@@ -39,8 +39,6 @@
##
#############################################################################
-from __future__ import print_function
-
import os
import sys
from PySide2.QtCore import QUrl
diff --git a/examples/declarative/signals/qmltopy4/main.py b/examples/declarative/signals/qmltopy4/main.py
index d165e61f3..278f3526f 100644
--- a/examples/declarative/signals/qmltopy4/main.py
+++ b/examples/declarative/signals/qmltopy4/main.py
@@ -39,8 +39,6 @@
##
#############################################################################
-from __future__ import print_function
-
import os
import sys
from PySide2.QtCore import QObject, QUrl
diff --git a/examples/declarative/usingmodel.py b/examples/declarative/usingmodel.py
index 9b67bd0d4..3d5e8be32 100644
--- a/examples/declarative/usingmodel.py
+++ b/examples/declarative/usingmodel.py
@@ -39,8 +39,6 @@
##
#############################################################################
-from __future__ import print_function
-
import os
import sys
from PySide2.QtCore import QAbstractListModel, Qt, QUrl, QByteArray
diff --git a/examples/installer_test/hello.py b/examples/installer_test/hello.py
index 3aa7a1564..c03fe1311 100644
--- a/examples/installer_test/hello.py
+++ b/examples/installer_test/hello.py
@@ -1,4 +1,3 @@
-# This Python file uses the following encoding: utf-8
# It has been edited by fix-complaints.py .
#############################################################################
@@ -52,7 +51,6 @@ test PyInstaller. See testing/wheel_tester.py .
When used with PyInstaller, it automatically stops its execution after
2 seconds.
"""
-from __future__ import print_function
import sys
import random
diff --git a/examples/network/fortuneclient.py b/examples/network/fortuneclient.py
index 00247eee0..ee4bc5670 100644
--- a/examples/network/fortuneclient.py
+++ b/examples/network/fortuneclient.py
@@ -118,13 +118,7 @@ class Client(QtWidgets.QDialog):
return
nextFortune = instr.readString()
-
- try:
- # Python v3.
- nextFortune = str(nextFortune, encoding='ascii')
- except TypeError:
- # Python v2.
- pass
+ nextFortune = str(nextFortune, encoding='ascii')
if nextFortune == self.currentFortune:
QtCore.QTimer.singleShot(0, self.requestNewFortune)
diff --git a/examples/samplebinding/CMakeLists.txt b/examples/samplebinding/CMakeLists.txt
index 8a2e55d66..aefc775fe 100644
--- a/examples/samplebinding/CMakeLists.txt
+++ b/examples/samplebinding/CMakeLists.txt
@@ -191,7 +191,7 @@ if(WIN32)
# Circumvent some "#pragma comment(lib)"s in "include/pyconfig.h" which might force to link
# against a wrong python shared library.
- set(python_versions_list 3 32 33 34 35 36 37 38)
+ set(python_versions_list 3 36 37 38 39)
set(python_additional_link_flags "")
foreach(ver ${python_versions_list})
set(python_additional_link_flags
@@ -224,7 +224,7 @@ endif()
install(TARGETS ${bindings_library} ${sample_library}
LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}
RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}
- )
+ )
install(FILES ${windows_shiboken_shared_libraries} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
# =============================================================================================
# !!! End of dubious section.
diff --git a/examples/samplebinding/main.py b/examples/samplebinding/main.py
index dc727c5d8..135eca12e 100644
--- a/examples/samplebinding/main.py
+++ b/examples/samplebinding/main.py
@@ -39,8 +39,6 @@
##
############################################################################
-from __future__ import print_function
-
"""An example showcasing how to use bindings for a custom non-Qt C++ library"""
from Universe import Icecream, Truck
diff --git a/examples/scriptableapplication/CMakeLists.txt b/examples/scriptableapplication/CMakeLists.txt
index f9fc25040..d80664f53 100644
--- a/examples/scriptableapplication/CMakeLists.txt
+++ b/examples/scriptableapplication/CMakeLists.txt
@@ -178,7 +178,7 @@ if(WIN32)
# Circumvent some "#pragma comment(lib)"s in "include/pyconfig.h" which might force to link
# against a wrong python shared library.
- set(PYTHON_VERSIONS_LIST 3 32 33 34 35 36 37 38)
+ set(PYTHON_VERSIONS_LIST 3 36 37 38 39)
set(PYTHON_ADDITIONAL_LINK_FLAGS "")
foreach(VER ${PYTHON_VERSIONS_LIST})
set(PYTHON_ADDITIONAL_LINK_FLAGS
diff --git a/examples/sql/books/bookwindow.py b/examples/sql/books/bookwindow.py
index 31d2a055f..59cd65840 100644
--- a/examples/sql/books/bookwindow.py
+++ b/examples/sql/books/bookwindow.py
@@ -38,8 +38,6 @@
##
#############################################################################
-from __future__ import print_function, absolute_import
-
from PySide2.QtWidgets import (QAbstractItemView, QDataWidgetMapper,
QHeaderView, QMainWindow, QMessageBox)
from PySide2.QtGui import QKeySequence
diff --git a/examples/utils/pyside2_config.py b/examples/utils/pyside2_config.py
index f759b11e5..135be79d4 100644
--- a/examples/utils/pyside2_config.py
+++ b/examples/utils/pyside2_config.py
@@ -148,15 +148,8 @@ def shared_library_suffix():
def import_suffixes():
- if (sys.version_info >= (3, 4)):
- import importlib.machinery
- return importlib.machinery.EXTENSION_SUFFIXES
- else:
- import imp
- result = []
- for t in imp.get_suffixes():
- result.append(t[0])
- return result
+ import importlib.machinery
+ return importlib.machinery.EXTENSION_SUFFIXES
def is_debug():
@@ -228,7 +221,7 @@ def find_package_path(dir_name):
return None
-# Return version as "3.5"
+# Return version as "3.6"
def python_version():
return str(sys.version_info[0]) + '.' + str(sys.version_info[1])
@@ -283,11 +276,7 @@ def python_link_data():
# Linux and anything else
else:
- if sys.version_info[0] < 3:
- suffix = '_d' if is_debug() else ''
- flags['lib'] = 'python{}{}'.format(version, suffix)
- else:
- flags['lib'] = 'python{}{}'.format(version, sys.abiflags)
+ flags['lib'] = 'python{}{}'.format(version, sys.abiflags)
return flags
diff --git a/examples/widgetbinding/CMakeLists.txt b/examples/widgetbinding/CMakeLists.txt
index 4cdfa648e..f948f7ca2 100644
--- a/examples/widgetbinding/CMakeLists.txt
+++ b/examples/widgetbinding/CMakeLists.txt
@@ -235,7 +235,7 @@ if(WIN32)
# Circumvent some "#pragma comment(lib)"s in "include/pyconfig.h" which might force to link
# against a wrong python shared library.
- set(python_versions_list 3 32 33 34 35 36 37 38)
+ set(python_versions_list 3 36 37 38 39)
set(python_additional_link_flags "")
foreach(ver ${python_versions_list})
set(python_additional_link_flags
diff --git a/examples/widgets/dialogs/classwizard/classwizard.py b/examples/widgets/dialogs/classwizard/classwizard.py
index d0e970f94..ecc1806be 100644
--- a/examples/widgets/dialogs/classwizard/classwizard.py
+++ b/examples/widgets/dialogs/classwizard/classwizard.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
@@ -40,7 +39,6 @@
##
#############################################################################
-from __future__ import unicode_literals
from PySide2 import QtCore, QtGui, QtWidgets
import classwizard_rc
diff --git a/examples/widgets/richtext/syntaxhighlighter.py b/examples/widgets/richtext/syntaxhighlighter.py
index 9be299401..576e8baef 100644
--- a/examples/widgets/richtext/syntaxhighlighter.py
+++ b/examples/widgets/richtext/syntaxhighlighter.py
@@ -75,14 +75,7 @@ class MainWindow(QtWidgets.QMainWindow):
inFile = QtCore.QFile(path[0])
if inFile.open(QtCore.QFile.ReadOnly | QtCore.QFile.Text):
text = inFile.readAll()
-
- try:
- # Python v3.
- text = str(text, encoding='ascii')
- except TypeError:
- # Python v2.
- text = str(text)
-
+ text = str(text, encoding='ascii')
self.editor.setPlainText(text)
def setupEditor(self):