aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2')
-rw-r--r--sources/pyside2/PySide2/support/generate_pyi.py10
-rw-r--r--sources/pyside2/tests/registry/init_platform.py6
2 files changed, 15 insertions, 1 deletions
diff --git a/sources/pyside2/PySide2/support/generate_pyi.py b/sources/pyside2/PySide2/support/generate_pyi.py
index a92ee76f0..21ef841fe 100644
--- a/sources/pyside2/PySide2/support/generate_pyi.py
+++ b/sources/pyside2/PySide2/support/generate_pyi.py
@@ -53,6 +53,13 @@ import re
import subprocess
import argparse
import glob
+# PYSIDE-953: Use a newer contextlib for Python 3.5
+skip_creation = False
+if sys.version_info[:2] == (3, 5):
+ try:
+ import PySide2.support.signature # gets new contextlib
+ except:
+ skip_creation = True
from contextlib import contextmanager
from textwrap import dedent
@@ -272,6 +279,9 @@ def single_process(lockdir):
def generate_all_pyi(outpath, options):
+ if skip_creation:
+ logger.warn("Sorry, we cannot create .pyi files with Python 3.5 while PySide")
+ logger.warn(" is not installed. Please run it by hand!")
ps = os.pathsep
if options.sys_path:
# make sure to propagate the paths from sys_path to subprocesses
diff --git a/sources/pyside2/tests/registry/init_platform.py b/sources/pyside2/tests/registry/init_platform.py
index a324c36a2..6031dd2ad 100644
--- a/sources/pyside2/tests/registry/init_platform.py
+++ b/sources/pyside2/tests/registry/init_platform.py
@@ -55,7 +55,8 @@ shiboken and pysidetest projects.
import sys
import os
import re
-from contextlib import contextmanager
+# PYSIDE-953: Use a newer contextlib for Python 3.5
+# from contextlib import contextmanager
from textwrap import dedent
script_dir = os.path.normpath(os.path.join(__file__, *".. .. .. .. ..".split()))
@@ -117,6 +118,9 @@ sys.path[:0] = [os.path.join(shiboken_build_dir, "shibokenmodule"),
pyside_build_dir]
import PySide2
+# PYSIDE-953: Use a newer contextlib for Python 3.5
+import PySide2.support.signature # new contextlib
+from contextlib import contextmanager
all_modules = list("PySide2." + x for x in PySide2.__all__)