aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2022-03-02 12:42:07 +0100
committerChristian Tismer <tismer@stackless.com>2022-03-02 17:42:45 +0100
commit0a9c75485ddab77bc1d01d731d5559cec3539d5c (patch)
tree054b69b77ed0a6b3f9980b3ec2439375ae937ccb
parent3dc73e778b0b56d5fce2652fddcf266b80f41b5f (diff)
generate_pyi: Fix an import timing problem on Windows
The generate_pyi output is tested by importing it. On Windows and in a venv, this creates an import cycle. This error could be attributed to PyPy as well because the bug was identified this way, but the reason for the trouble is not PyPy. The same effect happens with Windows, Python version > 3.6, venv or virtualenv and the setting "set QTEST_ENVIRONMENT=ci". Re-ordering imports solved the problem. Task-number: PYSIDE-535 Change-Id: I3dfca640afa5e2afd36b9fff3315e02447408dbd Pick-to: 6.2 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py
index 2ca969ad9..1b2c1cfcf 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py
@@ -138,8 +138,6 @@ class Formatter(Writer):
txt = f"""\
# Module `{mod_name}`
- from shiboken6 import Shiboken
-
<<IMPORTS>>
"""
self.print(dedent(txt))
@@ -201,6 +199,7 @@ FROM_IMPORTS = [
("enum", ["Enum"]),
("typing", typing.__all__),
("PySide6.QtCore", ["PyClassProperty"]),
+ ("shiboken6", ["Shiboken"]),
]
def filter_from_imports(from_struct, text):
@@ -297,9 +296,7 @@ def generate_pyi(import_name, outpath, options):
imp = "PySide6." + mod_name
if imp != import_name:
wr.print("import " + imp)
- # Do not import Shiboken which is handled already.
- if import_name != "Shiboken":
- wr.print("import " + import_name)
+ wr.print("import " + import_name)
wr.print()
wr.print()
else: