diff options
author | Christian Tismer <tismer@stackless.com> | 2019-02-26 09:44:01 +0100 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2019-03-20 17:33:21 +0000 |
commit | e8786b9cdccb63aa590af50fe5fa5496c6b216c7 (patch) | |
tree | 89f30d78603c81937f0c6dd9f768576b6463f9f7 /sources/pyside2/PySide2/support/generate_pyi.py | |
parent | c32dacab85b435751db2811e7a88d5c03b1856e1 (diff) |
Simplify Python Imports For Embedding
After the project split, shiboken exposed its own modules, and the
overall structure with shiboken2.support.signature and
PySide2.support.signature was already quite complicated.
When introducing embedding, it is necessary to have some support
folder that gets unpacked from a zipfile. That means, the shiboken2
root directory would be in the zip file in the embedding case.
This does not only increase the complexity, it further means
that we must make shiboken2.so available in the shiboken2
containing zipfile!
In order to avoid that, we stop the dependency from the two
support directories and use shibokensupport, instead. The
simplification of the loader and other modules is also significant.
Task-number: PYSIDE-510
Change-Id: Ic735a8d36f10f03698378f2ac9685a5955e40b0c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2/PySide2/support/generate_pyi.py')
-rw-r--r-- | sources/pyside2/PySide2/support/generate_pyi.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sources/pyside2/PySide2/support/generate_pyi.py b/sources/pyside2/PySide2/support/generate_pyi.py index a92ee76f0..8474fa732 100644 --- a/sources/pyside2/PySide2/support/generate_pyi.py +++ b/sources/pyside2/PySide2/support/generate_pyi.py @@ -55,6 +55,7 @@ import argparse import glob from contextlib import contextmanager from textwrap import dedent +import traceback import logging @@ -105,10 +106,11 @@ class Formatter(Writer): def module(self, mod_name): self.mod_name = mod_name self.print("# Module", mod_name) + self.print("import PySide2") self.print("import shiboken2 as Shiboken") - from PySide2.support.signature import typing - self.print("from PySide2.support.signature import typing") - self.print("from PySide2.support.signature.mapping import (") + from shibokensupport.signature import typing + self.print("from shibokensupport.signature import typing") + self.print("from shibokensupport.signature.mapping import (") self.print(" Virtual, Missing, Invalid, Default, Instance)") self.print() self.print("class Object(object): pass") @@ -254,7 +256,11 @@ def generate_pyi(import_name, outpath, options): logger.info("Generated: {outfilepath}".format(**locals())) if is_py3: # Python 3: We can check the file directly if the syntax is ok. - subprocess.check_output([sys.executable, outfilepath]) + try: + subprocess.check_output([sys.executable, outfilepath]) + except Exception as e: + print("+++ Problem executing test, although it works") + traceback.print_exc(file=sys.stdout) return 1 @@ -283,8 +289,8 @@ def generate_all_pyi(outpath, options): # now we can import global PySide2, inspect, HintingEnumerator import PySide2 - from PySide2.support.signature import inspect - from PySide2.support.signature.lib.enum_sig import HintingEnumerator + from shibokensupport.signature import inspect + from shibokensupport.signature.lib.enum_sig import HintingEnumerator valid = check = 0 if not outpath: |