aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/support/generate_pyi.py
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2/PySide2/support/generate_pyi.py')
-rw-r--r--sources/pyside2/PySide2/support/generate_pyi.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/sources/pyside2/PySide2/support/generate_pyi.py b/sources/pyside2/PySide2/support/generate_pyi.py
index 6a69a798a..9eb84de7a 100644
--- a/sources/pyside2/PySide2/support/generate_pyi.py
+++ b/sources/pyside2/PySide2/support/generate_pyi.py
@@ -1,4 +1,6 @@
# This Python file uses the following encoding: utf-8
+from __future__ import print_function, absolute_import, unicode_literals
+LICENSE_TEXT = """
#############################################################################
##
## Copyright (C) 2020 The Qt Company Ltd.
@@ -37,8 +39,7 @@
## $QT_END_LICENSE$
##
#############################################################################
-
-from __future__ import print_function, absolute_import, unicode_literals
+"""
"""
generate_pyi.py
@@ -201,14 +202,6 @@ class Formatter(Writer):
yield
-def get_license_text():
- with io.open(sourcepath) as f:
- lines = f.readlines()
- license_line = next((lno for lno, line in enumerate(lines)
- if "$QT_END_LICENSE$" in line))
- return "".join(lines[:license_line + 3])
-
-
def find_imports(text):
return [imp for imp in PySide2.__all__ if imp + "." in text]
@@ -228,7 +221,7 @@ def generate_pyi(import_name, outpath, options):
outfile = io.StringIO()
fmt = Formatter(outfile)
- fmt.print(get_license_text()) # which has encoding, already
+ fmt.print(LICENSE_TEXT.strip())
need_imports = not USE_PEP563
if USE_PEP563:
fmt.print("from __future__ import annotations")
@@ -307,6 +300,8 @@ def generate_all_pyi(outpath, options):
if __name__ == "__main__":
+ # PYSIDE-1621: Enforce embedding to ensure that it always works.
+ sys.pyside_uses_embedding = True
parser = argparse.ArgumentParser(
description="This script generates the .pyi file for all PySide modules.")
parser.add_argument("modules", nargs="+",